The EXTRACT function will look for a given key in a string with key=value pairs. Such a string can be a device value or a fixed string and will typically look like this:
key1=value1&key2=value2&....
Values can be strings or numbers
If the given key is found, its value is returned. If the key cannot be found, the function by default returns “*not found*”.
Using a third parameter this default can be set to a value of your own choice. This can be either a fixed string or number, or the key itself.
IF EXTRACT(mylabel.label, foo) == bar THEN .... (searches for key "foo" in mylabel.label and returns the corresponding value, or *not found* if the key "foo" is absent) IF EXTRACT(mylabel.label, foo, failed) != failed THEN .... (searches for key "foo" in mylabel.label and returns the corresponding value, or "failed" if the key "foo" is absent) IF EXTRACT(mylabel.label, foo, '$_KEY') == bar THEN .... (searches for key "foo" in mylabel.label and returns the corresponding value, or "foo" if the key "foo" is absent) IF 1==1 THEN label DEVICE mylabel TO 'some text' COLOR EXTRACT('on=red&off=green', myswitch.state) .... (searches for state of myswitch ("on" or "off") in "on=red&off=green" and sets the color to the corresponding value)