Short answer: substitute( Colour ; "yellow" ; "" ).
Longer answer needs info about how items are organized. Separated by newlines?
Thanks. Is it actually called 'substitute'? I cant see it in my list of functions.
The field is basically a pop-up menu box that allows multiple selections. When its viewed on the form each colour is on a new line yes.
Yes there is a function called substitute(). Be sure not do confuse script steps and functions.
Muliple items of value lists are separated by ¶. So you can use.
* Substitute( "¶"& Colours &"¶" ; ["¶yellow¶";"¶"]; ["¶¶";""] )
Homework: smarter version of this which does not leave newlines at beginning and end. Hint see here
Thanks again :-)
Its working great now, removing the line breaks when it should, and not when it shouldn't. For any body else's reference I did it like this:
Substitute ( Substitute ( Substitute ( Substitute ( Item::Colour ; "¶Yellow¶" ; "¶" ); "Yellow¶" ; "" ) ; "¶Yellow" ; "" ) ; "Yellow" ; "" )
This replaces, in this order:
- 'Yellow' found inbetween two other lines ("¶" inserted in its place - otherwise the line above and below end up side-by-side)
- 'Yellow' found with lines below it ("" inserted in its place)
- 'Yellow' found with lines above it ("" inserted in its place)
- 'Yellow' found on its own ("" inserted in its place)
Might be a bit of a 'bodge' but seems to work :-)
Thanks for your help.