You can use the instr() function to find text in a PropertyWizard function. It finds the position of one piece of text inside another, and returns the character position of the first character of the found text, or -1 if the text isn’t found.
So, say we want to find all the rooms where the room’s Name contains “Bedroom”, such as “Main Bedroom”, ” Bedroom 2″, etc. The formula for that would be:
To turn that into a true/false value, you could use:
instr(Name, "Bedroom") != -1
This checks whether the instr result is not equal to (!=) minus 1. It will return true if the Name contains “Bedroom” and false otherwise – you can put this true/false result directly into a Yes/No parameter.
Alternatively, if you wanted to get a text value as the result:
if(instr(Name, "Bedroom") != -1 , "Bedroom", "Not A Bedroom")
Here are the three formulas in PropertyWizard. I’ve made three new project parameters as target properties:
And here is the result in a Room schedule:
Notice how instr is case-sensitive – the formula has not found room number 4, because its name is “bedroom” not “Bedroom”. I will cover case-changing formulas in a future post, when the next version of PropertyWizard is live.
You can download the formulas XML here to import into your own project – you will need to change the target properties to suit your project: