Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: PLCwannabe on December 08, 2025, 11:00:36 AM
-
See attached. I'm trying to retrieve "currentValue" from string SL0. The instruction completes every time, but always returns value 3.0, rather than the expected value 7.0 . What could be the problem here? All the registers are only being used in that rung, I've tried using different registers, still getting the same results. If I use a string as the result, everything works correctly.
-
You don't utilize the Return Result of your JSONPARSE. It is probably failing because the value is NOT numeric, but is a STRING containing the text of a numeric value (that string could be "ABC", not "123").
The difference is the key/value pair of
"currentValue":"7.0"
"currentValue":7.0
(notice the difference?)
You will need to put the value of JSONPARSE key into another STRING element (e.g. SS0), then use a STR2REAL instruction to convert SS0 to KETherm25.
-
See attached. I'm trying to retrieve "currentValue" from string SL0. The instruction completes every time, but always returns value 3.0, rather than the expected value 7.0 . What could be the problem here? All the registers are only being used in that rung, I've tried using different registers, still getting the same results. If I use a string as the result, everything works correctly.
The value type is a string. When you assign a string to numeric, it just stuffs the length rather than attempting any form of conversion. I probably wouldn't have returned a float value as a string, particularly since they already had a string description, but that's what they've done.
-
Right on. Thanks guys.