WriteTextToLocalFile
Structure
WriteTextToLocalFile(sFileName,sStartFlag,sEndFlag,sToWrite)
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 text to be replaced.sEndFlag | String | the text that should be searched to end the text to be replace.sToWrite | String | the new text value that will be replaced into the text file |
Return Value
Char
'1' = Success, '0' = Failure
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. Use this function to write text back to this file, replacing the value after the sStartFlag, but before sEndFlag. So if you are reading an xml file (see snippet below), and you need to update the 'Unit Price' of '1.260' to a new value of '1.340'
<DiscountValue>0.84</DiscountValue>
<DiscountPercentage>40.0</DiscountPercentage>
<UnitPrice>1.260</UnitPrice>
<StandardCost>0.97</StandardCost>
Then you would call the function as:
if WriteTextToLocalFile('FromMyAccountingSystem.xml', '<UnitPrice>', '</UnitPrice>', '1.340') then
ShowMessage('Value written ok')
Else
ShowMessage('Value was not written')
End If
Example
No example provided
Application Compatibility
IndySoft Calibration Management, IndySoft Commercial Lab Management, IndySoft Tool Management
Also See
No related topics |