DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Script DAC Parse and NamedValueGet

Solved!
Go to solution

Hi there,

 

i´m still having some troubles with the parse method and NamedValueGet. Because the documentation isn´t very exactly i have some questions to the following lines:

 

**GetScan 

a=ouDim.Read(146,0)

ParseRes=ouDim.Parse(a,Parsedef)

 

Is it right that ParseRes should be an Array if the Parser was able to interpret the scan? What if the parser failed? Of what type is the Read and what if there was no data send?

 

**ReadChannel

DataP=ouDim.NamedValueGet(....)

Is it possible that the NamedValueGet-Method hangs if the parser couldnt interpret the data? Do i have to catch that error somehow or is it possible to initialize the channels so that would work even if the parser failed? 

 

Thanks a lot

diademi

 

 

0 Kudos
Message 1 of 4
(4,167 Views)

Hello diademi,

 

the result of the parse( ) function is depending on the Parsedef string. If there is only a single value defined in this string, the result of the function will be a simple variable. If the Parsedef string defined multiple values, the result of this function will be an array.

 

The parse() function normally returns as many values as defined in the Parsedef. However if the "Data" string contains less values than defined in the "Parsedef", the function will only return as many data as provided by the "Data" string. Therefore the result of this function is a little bit uncertain. If more than one value was parsed, the function will return an array containing as many elements as have been parsed. If only a single value was parsed, a simple variable will be returned and if no data was parsed, the function will return "false". If you are using named variables, in this case they may be undefined. So I would recommend not to use named variables if you are not sure that there will be sufficient data for the parse() function.

 

 

Read() returns a string and if there are no data sent the function will return an empty string. If the function times out, it will return a string the contains all data that have been read so far. So in case of a timeout the read() function may return less data than expected.

 

Rainer

 

 

0 Kudos
Message 2 of 4
(4,137 Views)

Thanks again RainerH,

 

I would understand if the NamedValueGet Function would throw some kind of error but it just hangs. But ok then this has to work without namedValues.

One more question. How can i initalize a channel (ReadChannel Part) with NoValue, DataP=NoValue/vbEmpty doesn´t work?

 

 

diademi

0 Kudos
Message 3 of 4
(4,129 Views)
Solution
Accepted by diademi

Hello diademi,

 

you can assign the NoValue to a variable but it will be handled as NULL. So I'm not sure if this will help you much.

 

Be carefull when you assign data to the DataP variable (the return value of the function). Internally the driver checks if this value is empty. If not, the driver assumes that the function has finished and will return the current value of this variable. So assigning a value to DataP should always be the last thing you do in SFD_ReadChannel(). Otherwise you may get incorrect results or unexpected side effects (expecially in asynchronous mode).

 

 

Rainer

 

 

Message 4 of 4
(4,125 Views)