Using substring function to set new variable
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
7 posts
Page 1 of 1
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
Can you post the full task and how you're using the Substring Function so that I can get an idea of what it is you're trying to do?
Thanks...
Thanks...
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Rick Here is the XML. My intent is to pull a claim number from the file name that is in a file list. I am using that to distribute the images received. I can do it using CL and RTVDIRINF, but thought it would be easier within GOANYWHERE. also wanted to test SUBTRING.
Code: Select all
<project name="PMSI Pharmacy Card Transfer" mainModule="Main" version="1.0" logLevel="verbose" onError="continue">
<description>Transfer copy of Pharmacy Cards for processing</description>
<module name="Main">
<timestamp label="System Timestamp" version="1.0">
<format outputVariable="Gray_timestamp" />
</timestamp>
<setVariable label="Email Recipients" name="Email_Recipients" value="[email protected], [email protected]" version="2.0" />
<sftp label="PMSI Connect" resourceId="PMSI" version="1.0" disabled="false" onError="call:Transfer Error">
<list label="PMSI Pharmacy Cards" fileListVariable="Gray_Pharmacy_Cards" numFilesFoundVariable="Gray_PC_Number">
<fileset dir="/users/grayins/outbound" recursive="false">
<wildcardFilter>
<include pattern="Gray_PC_*.ZIP" caseSensitive="false" />
</wildcardFilter>
</fileset>
</list>
<cd label="Go To Pharmacy Card Directory" dir="/users/grayins/outbound" />
<get label="Get Pharmacy Card File" sourceFilesVariable="${Gray_Pharmacy_Cards}" destinationDir="/PMSIT/Pharmacy Cards/" whenFileExists="overwrite" destinationFilesVariable="Destination_File_Name" numFilesDownloadedVariable="Destination_Files_Downloaded" processedSourceFilesVariable="Processed_File_Name" />
</sftp>
<createFileList label="Files to Unzip" fileListVariable="Files_To_Unzip" numFilesFoundVariable="No_Of_Files_To_Unzip" version="1.0" onError="call:Unzip Error">
<fileset dir="/pmsit/Pharmacy Cards/" recursive="false">
<wildcardFilter>
<include pattern="Gray_PC_*.Zip" caseSensitive="false" />
</wildcardFilter>
</fileset>
</createFileList>
<forEachLoop label="Unzip Retrieved Files" itemsVariable="${Files_To_Unzip}" currentItemVariable="Destination_File_Current">
<unzip label="Unzip Data and Image Zip File" inputFilesVariable="${Destination_File_Current}" outputDir="/PMSIT/Pharmacy Cards/Work Images" whenFileExists="overwrite" outputFilesVariable="File_Created" processedInputFilesVariable="Processed_File" numFilesExtractedVariable="Number_Of_Files" version="1.0" executeOnlyIf="${No_Of_Files_To_Unzip} gt 0" onError="call:Unzip Data Error" />
<createFileList label="PMSI Pharmacy Card Images Found" fileListVariable="Image_Found_List" numFilesFoundVariable="Image_Found_Count" version="1.0" executeOnlyIf="${No_Of_Files_To_Unzip} gt 0">
<fileset dir="/PMSIT/Pharmacy Cards/Work Images" recursive="true">
<wildcardFilter>
<include pattern="*.pdf" caseSensitive="false" />
</wildcardFilter>
</fileset>
</createFileList>
<move label="Move Zip Files To Archive" sourceFilesVariable="${Destination_File_Current}" destDir="/PMSIT/Pharmacy Cards/Archive" whenFileExists="overwrite" version="1.0" executeOnlyIf="${No_Of_Files_To_Unzip} gt 0" disabled="true" />
<createFileList label="PMSI Text Index File List" fileListVariable="Text_Found_List" version="1.0" disabled="true">
<fileset dir="/PMSIT/Pharmacy Cards/Work Images" recursive="false">
<wildcardFilter>
<include pattern="*.txt" caseSensitive="false" />
</wildcardFilter>
</fileset>
</createFileList>
<exec400 label="Export Images to Imageright" resourceId="Gray_Metairie_System_i" version="1.0" disabled="true">
<command>
<![CDATA[call graypgms/pmsebilixc parm('${Text_Found_List}')]]>
</command>
</exec400>
</forEachLoop>
<setVariable label="Test" name="Test_Variable" value="${Substring('text', 3)} " version="2.0" />
<sendEmail label="Pharmacy Card Retrieval Successful Email" resourceId="Gray Mail Server" toList="${Email_Recipients}" version="2.0">
<from address="[email protected]" name="PMSI Pharmacy Card Successful Transfer" />
<subject>
<![CDATA[${system.project.name}]]>
</subject>
<message>
<![CDATA[The following files were successfully retrieved:
${Test_Variable}
${Files_To_Unzip}]]>
</message>
</sendEmail>
<forEachLoop itemsVariable="${Gray_EBill}" currentItemVariable="Gray_EBill_Current" disabled="true">
<sftp label="Delete Zip Files Retrieved" resourceId="PMSI" version="1.0" disabled="false" onError="continue">
<delete label="Delete Files Retrieved" inputFilesVariable="${Gray_EBill_Current}" />
</sftp>
</forEachLoop>
</module>
<module name="Unzip Data Error" description="Error unzipping EOR data from Stratacare ">
<sendEmail label="Unzip Data Error" resourceId="Gray Mail Server" toList="${Email_Recipients}" version="2.0">
<from address="[email protected]" name="PMSI EBill Unzip Error" />
<subject>
<![CDATA[EBill Data Unzip Error ${system.project.name}]]>
</subject>
<message>
<![CDATA[An attempt to unzip the following file caused an error.
${Destination_File_Current}]]>
</message>
<attachment file="${system.job.log}" />
</sendEmail>
</module>
<module name="Update Error" description="Send email when error occurs updating files">
<sendEmail label="Update Error" resourceId="Gray Mail Server" toList="${Email_Recipients}" version="2.0">
<from address="[email protected]" name="PMSI EBill Update Error" />
<subject>
<![CDATA[${system.project.name}]]>
</subject>
<message>
<![CDATA[${system.project.name} ended in error during the update process.
]]>
</message>
<attachment file="${system.job.log}" />
</sendEmail>
</module>
<module name="Data Move Error" description="Error occurred moving data to Archive directory">
<sendEmail label="Data Move Error" resourceId="Gray Mail Server" toList="${Email_Recipients}" version="2.0">
<from address="[email protected]" name="PMSI EBill Move Error" />
<subject>
<![CDATA[${system.project.name}]]>
</subject>
<message>
<![CDATA[An error occurred when attempting to archive the following EOR zip file:
${Destination_File_Current}
]]>
</message>
<attachment file="${system.job.log}" />
</sendEmail>
</module>
<module name="Transfer Error" description="Send email when transfer error.">
<sendEmail label="Error retrieve files" resourceId="Gray Mail Server" toList="${Email_Recipients}" version="2.0">
<from address="[email protected]" name="PMSI EBill File Retrieval Error" />
<subject>
<![CDATA[${system.project.name}]]>
</subject>
<message>
<![CDATA[An error occurred when attempting to retrieve EBILL information from PMSI.
This was a connection error.
See attached log.
]]>
</message>
<attachment file="${system.job.log}" />
</sendEmail>
</module>
</project>
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
To utilize the SubString (and all the updated functions) you will need to upgrade your project from version 1.0 to 2.0.
This can be accomplished by editing your project and clicking on the "Upgrade Project" in the menu. This will give you access to the newer System Variables/System Functions .. (including the Substring)
Try this and see if it doesn't help correct the issues.
If you still have more questions, please let us know!
This can be accomplished by editing your project and clicking on the "Upgrade Project" in the menu. This will give you access to the newer System Variables/System Functions .. (including the Substring)
Try this and see if it doesn't help correct the issues.
If you still have more questions, please let us know!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
On Page 146 of the GAD 4.5 User Guide, there is a section on Expressions. This is how the variables and functions that are associated to version 2.0 of the project are used. Please review that section for further information...
Since you are familiar with Version 1.0 variables, this will give you a heads-up on how to use them under Version 2.0.
In a nutshell, you only need one set of ${ ... } to process variable expressions. In the case of what you're trying to do, you would perform the Substring like this:
Setvariable "MyVariable" = "ThisIsMyValue"
${ Substring( MyVariable, 5, 4 ) }
would return "IsMy"
Or, for concatenation, like this:
${ Concat( Substring( MyVariable, 5, 4 ), '.', CurrentDate( 'yyyyMMdd' ), '.txt' ) }
would return "IsMy.20140516.txt"
Hope this helps!
Since you are familiar with Version 1.0 variables, this will give you a heads-up on how to use them under Version 2.0.
In a nutshell, you only need one set of ${ ... } to process variable expressions. In the case of what you're trying to do, you would perform the Substring like this:
Setvariable "MyVariable" = "ThisIsMyValue"
${ Substring( MyVariable, 5, 4 ) }
would return "IsMy"
Or, for concatenation, like this:
${ Concat( Substring( MyVariable, 5, 4 ), '.', CurrentDate( 'yyyyMMdd' ), '.txt' ) }
would return "IsMy.20140516.txt"
Hope this helps!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
7 posts
Page 1 of 1