ReadValue
- Details
- Last Updated on Tuesday, 29 January 2013 16:31
syntax
-
ReadValue(source, valuetype, startposition)
definition
ReadValue(source, valuetype, startposition) results in a parameter with a specific value from a source parameter. The second argument specifies the value type and the third argument the startposition in the source. Spaces/tabs are used as delimiter. The numbering of the positions is counted from left to right, meaning position two is the position of the second character in the first row.
The ReadValue function also results in a uint32 parameter, called ReadPos. This parameter indicates the position of the next value after the value being read by the ReadValue function, see the example.
description
The ReadValue function is mainly used to read a specific value from a small text file, like an ini file. Use the ReadArray function to read a whole row from a text file.
applies to
source is a parameter with value type:
- String
valuetype can be any value type
startposition is a parameter with value type:
- uint32
example
container ReadValuedemand.ini:
{
parameter<string> File: StorageName = "%projDir%/data/demand.ini",
StorageType = "str";
parameter<uint32> Value1:
expr = "ReadValue(File, uint32, 0)"; Result = 6
parameter<float32> Value2:
expr = "ReadValue(File, float32, Value1/ReadPos)"; Result = 9.02
parameter<string> Value3:
expr = "ReadValue(File, string, Value2/ReadPos)"; Result = 'Test'
parameter<bool> Value4:
expr = "ReadValue(File, bool, Value3/ReadPos)"; Result = True
parameter<uint32> Value5:
expr = "ReadValue(File, uint32, Value4/ReadPos)"; Result = 25000}
| 6 | 9.02 | Test | True | |||
| 25000 | 27500 | 11000 | 6100 | 14400 | 300 | 70 |
| 30000 | 32500 | 12000 | 6200 | 14500 | 320 | 72 |
| 35000 | 37500 | 13000 | 6300 | 14600 | 340 | 74 |
| 40000 | 42500 | 14000 | 6400 | 14700 | 360 | 76 |
| 45000 | 47500 | 15000 | 6500 | 14800 | 380 | 78 |
| 50000 | 52500 | 16000 | 6600 | 14900 | 400 | 80 |