Dynamically display text in a text field

Forum Home Forums Understanding the Software Dynamically display text in a text field

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #594
    Avatardejan
    Participant

    Is it possible and how to display a text message that is dependent on the input channel value? For example, if the channel value = 1, display text = “Message 1” and if the channel value = 2, display text = “Message 2”.

    #595
    MikhailMikhail
    Moderator

    Hi,

    It’s easy. Add your messages to Units table like “Alarm states 1” record. Then select created unit for an input channel with Discrete channel type and Text format.

    1st message is 0.0 (value)
    2nd message is 1.0
    etc.

    #805
    Avatarbabeshkin
    Participant

    Mikhail, for me personally your answer is not clear. You propose to operate with units but….. how to create formula with reference to the different units?

    I also tried to create input channel (type of channel=”Calculated tele signal”, format=”Text”) which outputs text values using following function (for dynamic outputting text values in the Web-browser):
    MyMode(GetBit(Val(308),1)) – here I read value from channel 308 (it ‘working OK) and try to get text for output value.

    public String MyMode(double val)
    {
    if (val==0.0)
    {
    return “Stop”;
    }
    else
    {
    return “Running”;
    }
    }

    But the formula is not working (in diagnostic windows everything is OK) and I feel that my way is wrong…..
    What’s wrong?

    #808
    Avatarbabeshkin
    Participant

    Now it’s clear:

    1. In new string of Unit table in column “designation” put for instance “Alarm state 1; Alarm state 2”
    2. Then select created unit for an input channel with Discrete channel type and Text format;
    When applying text format for input channel that means using unit text instead of digital values!

    In this case if input channel value(also one can use formula) is equal 0 then appears message “Alarm state 1”, if value= 1 then “Alarm state 2”.

    #809
    MikhailMikhail
    Moderator

    Definetely! Thanks for the clarification 😉

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