How to write value and appear on the screen?

Forum Home Forums Understanding the Software Using Formulas How to write value and appear on the screen?

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #14300
    enviromixti
    Participant

    I 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 v6

    #14305
    Mikhail
    Moderator

    Hello,
    To allow a user setting a channel value, create a channel of the Calculated/Output type, and set it’s output formula to SetData()
    DynamicText will show the current value of the channel.

    #14313
    enviromixti
    Participant

    Hello,

    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?

    #14319
    Mikhail
    Moderator

    Hello,
    Channel 46804 is not needed.
    In the channel 46805 the output formula is just SetData()
    The above should work, see https://ibb.co/KqvK15r

    #15729
    XptoPT
    Participant

    Hello 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
    #15736
    Mikhail
    Moderator

    Hello,

    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;
    }
    #15737
    Mikhail
    Moderator

    Channel should be of the Calculated/output type

    #15749
    XptoPT
    Participant

    Hello 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.

    #15756
    Mikhail
    Moderator

    Hello,
    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.

    #15757
    Mikhail
    Moderator

    Data type = Unicode string
    Format = String
    Output formula = SetUnicode()

    #15763
    XptoPT
    Participant

    Hello 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.

    #15770
    Mikhail
    Moderator

    Hi,
    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.

    #15778
    XptoPT
    Participant

    Hello 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.

    #15799
    Mikhail
    Moderator

    Hello,
    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.

    #15815
    XptoPT
    Participant

    Hello Mikhail,

    Thanks for the explanation, now I understand.

    Best regards.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.