logo-header

 
 

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

parameter source with string value type

valuetype can be any value type

parameter startposition with uint32 value type

example

container ReadValue
{
parameter<string>  File
: StorageName = "%projDir%/data/demand.ini"
, StorageType = "str";
parameter<uint32>  Value1 :=
ReadValue(File, uint32,  0); Result = 6
parameter<float32> Value2 :=
ReadValue(File, float32, Value1/ReadPos); Result = 9.02
parameter<string>  Value3 :=
ReadValue(File, string,  Value2/ReadPos); Result = 'Test'
parameter<bool>    Value4 :=
ReadValue(File, bool,    Value3/ReadPos); Result = True
parameter<uint32>  Value5 :=
ReadValue(File, uint32,  Value4/ReadPos); Result = 25000
}

demand.ini:

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

see also


OBJECT VISION BV
Vrije Universiteit
De Boelelaan 1085
1081 HV Amsterdam
The Netherlands

tel: +31 (0)20 598 9083
fax:+31 (0)20 598 9904