Zum Hauptinhalt springen

GetTextFromLocalFileSection

Structure

GetTextFromLocalFileSelection(sFileName,sStartFlag,sEndFlag,sSectionStartFlag,sSectionEndFlag,sIDStartFlag,sIDEndFlag,sIDValue)

Parameters

| Parameter | Type | Description
| sFileName | String | the name of the file in the IndySoft temporary directory that should be read. This is simply the file name plus the extension - this should NOT include the full directory path.sStartFlag | String | the text that should be searched to begin the return text. The return text will NOT include this sStartFlag text.sEndFlag | String | the text that should be searched to end the return text. The return text will NOT include this sEndFlag.sSectionStartFlag | String | the text that should be searched to begin the appropriate sectionsSectionEndFlag | String | the text that should be searched to end the appropriate sectionsIDStartFlag | String | the text that should be searched (in the sSection returned from above 2 parameters) to find the beginning of the ID fieldsIDEndFlag | String | the text that should be searched (in the sSection returned from above 2 parameters) to find the end of the ID fieldsIDValue | String | the text that should be compared to the returned ID text, to see it we have found the appropriate section. If so, the sStartFlag and sEndFlags are used to find the appropriate piece of information from this section. |

Return Value

String

Description

Functions in the 'Local File Read/Write Functions' group are used typically to create and read xml (or other) files from a common network directory to sync IndySoft's data/functionality with another system, like an accounting system. This function requires that a fie having the name sFileName exists in the current IndySoft temp directory - likely copied there from the 'GetLocalFile' function. Typically this is an xml file with data from another database application. This function is similar to GetTextFromLocalFile, but it only reads from a particular section of the file, and checks each section for an exact ID. As an example, say you are reading an xml file that returns cost information for a group of parts. The xml file might appear as below:
 
<?xml version='1.0' encoding='UTF-8' ?>

<PriceResponse>

<Header>

<Customer>100078</Customer>

<Code>AIT</Code>

</Header>

<PartDetailItem>

<LineNo>1</LineNo>

<PartNumber>PA0234</PartNumber>

<UnitPrice>10.23</UnitPrice>

</PartDetailItem>

<PartDetailItem>

<LineNo>2</LineNo>

<PartNumber>PA4343</PartNumber>

<UnitPrice>23.45</UnitPrice>

</PartDetailItem>

<PartDetailItem>

<LineNo>3</LineNo>

<PartNumber>PA8974</PartNumber>

<UnitPrice>56.45</UnitPrice>

</PartDetailItem>

</PriceResponse>
 
To continue the example, say you need to know the UnitPrice for PartNumber = 'PA4343'. You would only be interested in looking at the 'PartDetailItem' sections, and specifically only the detail section that had the 'PartNumber' field equal to 'PA4343'. Below is the custom script you would use:
 
sPrice = GetTextFromLocalFileSection('FromMyAccountingSystem.xml', '<UnitPrice>', '</UnitPrice>', '<PartDetailItem>', '</PartDetailItem>', '<PartNumber>', '</PartNumber>', 'PA4343')

Example

No example provided

Application Compatibility

IndySoft Calibration Management, IndySoft Commercial Lab Management, IndySoft Tool Management

Also See

No related topics |