Create Lookup Formula/Script

Forum Home Forums Understanding the Software Using Formulas Create Lookup Formula/Script

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16520
    WayneS
    Participant

    Greetings. I would like to create a formula or script that operates in a similar way to the lookup function in excel. Essentially I have a value from 0-255 where each value menas something different, i.e.
    0= Normal operation
    1= Engine Fault
    2= Generator fault … to 255=overtemperature.

    Many thanks

    • This topic was modified 2 months, 3 weeks ago by WayneS.
    #16522
    JW
    Participant

    for fewer values, you can create a new format as eum.
    e.g.
    create a new row in format table,
    MyFormat, enable “is Enum”, enter “Normal operation;Generator fault”
    config the channel
    MyCnl, selelct “MyFormat” as format
    Then when the value is 0, will display Normal operation, when is 1, will display Generator fault.

    but for 256 values, maybe better use a script to convert the number to string.
    e.g.
    keep the original channel and value Cnl 101
    create a new channel as converted string Cnl 102, enable input formula, set the formula as Val2String(101)
    and you need to define the Val2String() function by creating a new row on the Script table

    #16525
    Mikhail
    Moderator

    Hi,
    As an example, open the Formats table ach check the Off-On format.
    If you have many values in an enumeration, it’s supported to text each value per line.

    #16560
    WayneS
    Participant

    Thanks, That all makes sense 🙂

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