Using a Multi State Indicator value to reference a SQLtag

Hello,

I would like to use the state of a multistate indicator to reference a sqltag. For example:

When the state is:
21
the indicator text value is the same as the current value of the tag:
“S90/HMI/Torque Value”

I don’t want to set up an expression based on the state because I have something like 45 values, and I want other people to be able to diagnose this code later.

Anyways to do this intuitively?

Thank you

Can you give me a few examples of states? Hard to formulate a plan based on one example… :smiley:

If you store the ID and Descriptions in a database, then you could get the value from the database in a custom property with this expression binding:

CustomProp:

runScript("system.db.runScalarQuery('SELECT StateTag FROM States WHERE StateID = 21')")

then you would use indirect binding in the Text Field:

Indirect Tag Path: {1}

References:
Ref # 1 -> Property Path: Root Container.Text Field.CustomProp

Thanks for the quick replies.

What I was hoping for was a way inside the Designer GUI to reference the value of a string SQLtag as the text for a state. I know that this can be accomplished both with scripting and with sql calls, but this project is going to be maintained by people who are not as Ignition affluent. I would like a more intuitive way for them to be able to accomplish this task.

Example of the goal of this task:

Some way to syntactically reference in the text column of this dataset viewer a SQLtag.
i.e. When the state of the above component is 19 instead of saying “SMART FRAME PICK ACTIVE” it would say [S90\Station_20\HMI\Pick String] Where the tag at that location held a string value of a pick string.

Other HMI creation programs have a way to embed a tag value into the text of a given state of a multistate indicator. (e.g. Factory Talk ViewStudio). Maybe this post should be a future state request for Ignition as a platform.

Thank you

Ok, makes sense now.

Actually, I’d given up using multistate indicators a while ago for similar reasons. I ended up rolling my own, since we don’t use animation here.

I make mine using a standard label with a dataset attached to store process steps, Descriptions, and background color

For this one, I added a column that stores a tag path.

Finish up with some lookup functions bound to different properties, and concatenate the text together.

Here’s a sample.
[attachment=0]IndirectTest.vwin[/attachment]
EDIT: Just had a DOH! moment… actually, you could add similar properties to a multistate and do the same lookups. You can then concatenate the results and bind it to the text property. That would give the animation options back.
[attachment=3]2014-02-05_14-14-53.png[/attachment][attachment=2]2014-02-05_14-29-47.png[/attachment][attachment=1]2014-02-05_14-33-30.png[/attachment]

That’s a great solution, Jordan.

Thanks for the help! :thumb_left: