Ignition Perspective need to find character in text

Hello, I searched Ignition and internet and cannot see usable find string inside of text field. I need to do a CHARINDEX() (from SQL) or a FIND() (from EXCEL) to find a “-” in a text field.

Thanks

Use the expression function.

indexOf({this.props.text},"-")

Or with scripting:

text.find("-")

Thanks, I tried several variations of it and I could not get it to find it. Did I apply this correctly?

If you’re in a script you need to use Python instead of Ignition’s Expression language.

if text[0] == '-':
    some logic here
2 Likes

Great. Will try it.

Thanks! It worked.