This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

250 byte string, position
#3
Hi Admin,

Sorry but I tried your script,

i add the first script to Custom CSS '/scada-main/main/editor?id=css'
add pre to the Additional class, pre
I add a groupadres with 250 byte string '0/1/1'
I run the script and sent it to the group adress i added.

Code:
v1 = 2.234
v2 = 23.45
v3 = 345.6
v4 = 4567
text = string.format(' %10.3fW %10.3fW %10.3fW %10.3fW', v1, v2, v3, v4)

-- write value (e.g. boolean 'true') to object with group address 1/1/1, datatype must be set for this object
grp.write('0/1/1', text)

I'm not sure what i'm doing wrong, but it didn't work.
Not if i look at the groupadress by it self and not on desktop view of the visualization (not the edit mode).

i got the next value when i sent it to the group adress: 2.234W 23.450W 345.600W 4567.000W
It looks like the %10 didn't work the second part of it (.3f W) works fine.



Is it also possible to got a value like
01.123W, and not 1.123W?

I tried to do it by myself, but all i tried didn't work.

what i try to get is this
Code:
v1 = 0.234
v2 = 3.45
v3 = 45.6
v4 = 123.7

string showing like:
00.234 W  03.450 W  45.600 W  123.7 L --(for the first 3 values, always show 2 digits before the .(dot) and 3 digits behond the .(dot) and for value 4, 3 digits before the .(dot) and just 1 behind.
1234567890123456789012345678901234567890 (position of character)

I hope you can help me with this.
Reply


Messages In This Thread
250 byte string, position - by Dré - 29.05.2022, 11:47
RE: 250 byte string, position - by admin - 30.05.2022, 06:45
RE: 250 byte string, position - by Dré - 31.05.2022, 18:29
RE: 250 byte string, position - by admin - 01.06.2022, 07:18
RE: 250 byte string, position - by Dré - 01.06.2022, 15:35
RE: 250 byte string, position - by admin - 01.06.2022, 15:40
RE: 250 byte string, position - by Dré - 01.06.2022, 15:54
RE: 250 byte string, position - by admin - 01.06.2022, 16:21

Forum Jump: