Forum Home › Forums › Understanding the Software › Using Formulas › How to write value and appear on the screen?
Tagged: DynamicPicture, DynamicText
- This topic has 14 replies, 3 voices, and was last updated 5 months ago by
XptoPT.
-
AuthorPosts
-
March 28, 2024 at 2:49 pm #14300
enviromixti
ParticipantI need help in creating a script in which when selecting a DynamicPicture an OutPut that appears a field to enter value and changes the image from “Not selected” = 0 to “Resolved” = n and shows the value n in the Input that is DynamicText, with the condition of all days being 0 until selecting the button for “Resolved”
Screen Scheme Editor
Rapid SCADA Web
I’m using Rapid SCADA v6March 29, 2024 at 11:02 am #14305Mikhail
ModeratorHello,
To allow a user setting a channel value, create a channel of the Calculated/Output type, and set it’s output formula toSetData()
DynamicText will show the current value of the channel.April 1, 2024 at 1:52 pm #14313enviromixti
ParticipantHello,
Could you give an example of how to use SetData(), I had never used this function
Number 46804 = channel Input
Number 46805 = channel Calculated/Output Output Formula SetData(46804, …)
To write and save in internal memory and display?
April 2, 2024 at 12:12 pm #14319Mikhail
ModeratorHello,
Channel 46804 is not needed.
In the channel 46805 the output formula is justSetData()
The above should work, see https://ibb.co/KqvK15rDecember 10, 2024 at 8:34 pm #15729XptoPT
ParticipantHello Mikhail,
Is there a formula like SetData() that can be used for text (string)?
I need to create dynamic text so that the operator can edit the text whenever necessary.
I’m using V6.
Thanks for the help.
Best regards.-
This reply was modified 5 months, 1 week ago by
XptoPT. Reason: Add additional information
December 11, 2024 at 11:08 am #15736Mikhail
ModeratorHello,
Try
public byte[] SetUnicode() { if (ArrIdx == 0) { string s = CmdData == null ? "null" : Encoding.UTF8.GetString(CmdData); int dataSize = Channel.DataLen ?? 1; for (int i = 0; i < dataSize; i++) { string part = Substring(s, i * 4, 4); SetData(CnlNum + i, EncodeUnicode(part), 1); } } return CmdData; }
December 11, 2024 at 11:08 am #15737Mikhail
ModeratorChannel should be of the Calculated/output type
December 11, 2024 at 11:20 pm #15749XptoPT
ParticipantHello Mikhail,
Thanks for the quick response.
I have no experience using Rapid Scada, I need a more detailed explanation.
Where should I post the code you wrote?
How should I configure the other channel parameters (e.g. Data Type, Input and output formula, format, command format)?
Thank you very much for your help and patience.
December 12, 2024 at 2:03 pm #15756Mikhail
ModeratorHello,
You should add the SetUnicode function into the Scripts table. Then use it in the channel’s formula field.
If you provide screenshots of your settings, I can check.December 12, 2024 at 2:05 pm #15757Mikhail
ModeratorData type = Unicode string
Format = String
Output formula =SetUnicode()
December 12, 2024 at 11:22 pm #15763XptoPT
ParticipantHello Mikhail,
I want to start by thanking you for your help.
I have already tested and your code is working.
But I need an improvement.
The result only displays up to 4 characters.
For example, if I type “asdfghjkl”, the result displayed is “asdf”.
To make sure the customer has no limitations, can you please provide a code that accepts 50 characters?
Thank you very much for your help.
Best regards.December 13, 2024 at 11:09 am #15770Mikhail
ModeratorHi,
Try setting channel’s Data Length to 3, for example. Note that next 2 channels may not sequential channel numbers.
Each 1 of data length may contain up to 4 Unicode characters.December 15, 2024 at 6:16 pm #15778XptoPT
ParticipantHello Mikhail,
Changing the Data Length worked.
“Note that the next 2 channels may not be sequential channel numbers.”
I didn’t quite understand this note, please explain it to me in more detail.
Thank you very much for your help.
Best regards.December 16, 2024 at 2:46 pm #15799Mikhail
ModeratorHello,
If channel 101 has length = 3, there are shadow channels 102 and 103 are created by Server.
You should not use channel numbers 102 and 103 explicitly in the Channels table.December 16, 2024 at 10:33 pm #15815XptoPT
ParticipantHello Mikhail,
Thanks for the explanation, now I understand.
Best regards.
-
This reply was modified 5 months, 1 week ago by
-
AuthorPosts
- You must be logged in to reply to this topic.