Support Forums
String manipulation

Hi,

in Data Taker, do we have string manipulation ?

Example syntax:
IF(2$=="test"){7CV=2CV}

But that syntax is invalid. Any suggestion ?

Hi, in Data Taker, do we have string manipulation ? Example syntax: IF(2$=="test"){7CV=2CV} But that syntax is invalid. Any suggestion ?

Hi Wanrosli,

At this stage data Taker does support string validation ,

The equality (==) and inequality (!=) tests should normally only be used where the quantities being compared are integers,you might have rounding errors if you use Floating points.

Please provide more information on the program, where you want to use this validation , so that i can see if we can find any workarounds.

are you getting the string Value (EG:"Test") from a serial communication ?

are you assigning that ?

can you replace them with Integers/Constants ?

Thanks
Regards
Lokesh

Hi Wanrosli, At this stage data Taker does support string validation , The equality (==) and inequality (!=) tests should normally only be used where the quantities being compared are integers,you might have rounding errors if you use Floating points. Please provide more information on the program, where you want to use this validation , so that i can see if we can find any workarounds. are you getting the string Value (EG:"Test") from a serial communication ? are you assigning that ? can you replace them with Integers/Constants ? Thanks Regards Lokesh

Hi Lokesh,

Yes, i received the data through GSM modem (serial)

Application that i want to made is, let says i send SMS message "pull" from my mobile, then GSM modem will received the SMS and will send this string to data taker.

After that, i need to partial it the string received from modem and made some condition.

The message received cannot change to integer.

Hi Lokesh, Yes, i received the data through GSM modem (serial) Application that i want to made is, let says i send SMS message "pull" from my mobile, then GSM modem will received the SMS and will send this string to data taker. After that, i need to partial it the string received from modem and made some condition. The message received cannot change to integer.

Hi Wanrosli,

Does the width of the incoming string varies? can you keep that constant.

I tried the following workaround on my logger and it works

i saved the incoming string as character into CV and the value saved is numeric

Transmission :

DT80> 1serial("{Pull}")
1SERIAL: RxBuf=0[]
1SERIAL: OutputActions: "Pull"
1SERIAL: Tx [Pull]
1SERIAL 0 Stat

Receiving and Parsing :

DT80> 1SERIAL: RxBuf+4[Pull]
1serial("%4c[10CV]")
1SERIAL: RxBuf=4[Pull]
1SERIAL: InputAction: "%4c[10CV]"
1SERIAL: RxBuf-0[]
1SERIAL 0 State

DT80> 10cv
10CV 108.0

Another Example:

DT80> 10cv
10CV 0.0

DT80> 1serial("%4c[10CV]")
1SERIAL: RxBuf=4[Stop]
1SERIAL: InputAction: "%4c[10CV]"
1SERIAL: RxBuf-0[]
1SERIAL 0 State

DT80> 10cv
10CV 112.0

You can use the CV values in your If statements

Thanks
Regards
Lokesh

Hi Wanrosli, Does the width of the incoming string varies? can you keep that constant. I tried the following workaround on my logger and it works i saved the incoming string as character into CV and the value saved is numeric Transmission : DT80> 1serial("{Pull}") 1SERIAL: RxBuf=0[] 1SERIAL: OutputActions: "Pull" 1SERIAL: Tx [Pull] 1SERIAL 0 Stat Receiving and Parsing : DT80> 1SERIAL: RxBuf+4[Pull] 1serial("%4c[10CV]") 1SERIAL: RxBuf=4[Pull] 1SERIAL: InputAction: "%4c[10CV]" 1SERIAL: RxBuf-0[] 1SERIAL 0 State DT80> 10cv 10CV 108.0 Another Example: DT80> 10cv 10CV 0.0 DT80> 1serial("%4c[10CV]") 1SERIAL: RxBuf=4[Stop] 1SERIAL: InputAction: "%4c[10CV]" 1SERIAL: RxBuf-0[] 1SERIAL 0 State DT80> 10cv 10CV 112.0 You can use the CV values in your If statements Thanks Regards Lokesh

Lokesh this is a very useful solution you have presented for managing incoming text strings.

You stated ["saved the incoming string as character into CV and the value saved is numeric"].

My question is can you steer me to a dataTaker table or reference that tells me how the numeric value is determined by the logger for any given text string. If I know where to find this information I can make very good use of this functionality.

Lawrence

Lokesh this is a very useful solution you have presented for managing incoming text strings. You stated ["saved the incoming string as character into CV and the value saved is numeric"]. My question is can you steer me to a dataTaker table or reference that tells me how the numeric value is determined by the logger for any given text string. If I know where to find this information I can make very good use of this functionality. Lawrence

Hi Lawrence,

You may find that information in our DT8x manual, section O Sensors and Channels, sub Section Generic SERIAL channel and title Control String Input Action (page 356).
There are various allocation type for incoming string and you may find some example as well.

Best regards,
Rudy Gunawan

Hi Lawrence, You may find that information in our DT8x manual, section O Sensors and Channels, sub Section Generic SERIAL channel and title Control String Input Action (page 356). There are various allocation type for incoming string and you may find some example as well. Best regards, Rudy Gunawan
37
6
4
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft