2021-09-13 06:39 AM
I have set up a CONCAT expression to merge a bunch of various properties and text (for the sake of this example I'll refer to it as CONCAT-1.
I want the expression to present different information depending on the renovation status of the element.
I think what I need is an IF function, something like:
IF the element is new then show CONCAT-1,
IF the element is existing then show CONCAT-2,
IF the element is to be demolished then show CONCAT-3.
However, I am not having much luck at all with the IF function in the expressions.
2021-09-13 06:44 AM - last edited on 2021-09-13 10:39 PM by Laszlo Nagy
If it's of any use I have pasted the expression I have at the moment, where I have attemped an IF function, I'm cleary missing a fundamental step of how the IF function works wither particular respect to the "logical" field but not sure how to tackle.
IF ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}=new, (CONCAT ( {Property:B1 | STRUCTURE/Timber size}, " ", {Property:B2 | DURABILITY/Treatment}, " ", "(", {Property:B1 | STRUCTURE/Type \/ Grade}, ")", " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " with ", "Studs @ ", {Property:B1 | STRUCTURE/Studs}, " and ", "Nogs @ ", {Property:B1 | STRUCTURE/Nogs} )), - )
2021-09-13 12:05 PM
Hi, I think you have made simple mistake in typing by missing " " signs . Renovation = "New Status" and a the end "-"
do try and let me know if I am able to solve your problem 👍
2021-09-13 12:14 PM
You would be better using the IFS statement instead of IF, which would be more direct. Make sure the return type is set properly and also the classification.
2021-09-13 11:40 PM
Thanks guys, I think I'm getting closer.
I ended up trying the IFS function as I have 3x logical tests (reno status').
Have only entered two so far.
Below is what I have updated to, but still comes up with syntax error.
I expanded out to hopefully make it clearer, I also included the default IFS fields as a guide.
2021-09-13 11:46 PM
Actually even simplify the IFS expression is still producing a syntax error.
2021-09-14 12:37 AM
Remove the square brackets. Square brackets indicate the statements is optional and brackets should not be included.
Values are case sensitive Values should be "New" and "Existing"
2021-09-14 01:47 AM - edited 2021-09-14 01:49 AM
Thanks, so close, still coming up against syntax errors as I develop further.
I have done a screen recording https://youtu.be/vGhFH_tvyeQ
I have tried to develop further using IFS
The below works
IFS ( {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "New", ( ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", {Property:B1 | STRUCTURE/Timber size}, " ", {Property:B2 | DURABILITY/Treatment}, " ", "(", {Property:B1 | STRUCTURE/Type \/ Grade}, ")", " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " with ", "Studs @ ", {Property:B1 | STRUCTURE/Studs}, " and ", "Nogs @ ", {Property:B1 | STRUCTURE/Nogs} ) ) ) )
If I try adding another expression beneath it doesn't recognize the second expression
IFS ( {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "Existing", ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " to remain" ) ) )
If I try add to the end of the first expression, I stell get syntax errors.
IFS ( {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "New", ( ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", {Property:B1 | STRUCTURE/Timber size}, " ", {Property:B2 | DURABILITY/Treatment}, " ", "(", {Property:B1 | STRUCTURE/Type \/ Grade}, ")", " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " with ", "Studs @ ", {Property:B1 | STRUCTURE/Studs}, " and ", "Nogs @ ", {Property:B1 | STRUCTURE/Nogs} ) ) ) ),( {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "Existing", ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " to remain" ) ) )
If I try add square brackets like in the default I still get syntax errors.
2021-09-14 01:54 AM
The default looks like this.
IFS ( LogicalCondition1, Value1, [LogicalCondition2, Value2], ... )
If I just try replacing the fields and leaving brackets in place I would have thought that would work.
2021-09-14 02:02 AM
Success!!!
IFS ( {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "New", ( ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", {Property:B1 | STRUCTURE/Timber size}, " ", {Property:B2 | DURABILITY/Treatment}, " ", "(", {Property:B1 | STRUCTURE/Type \/ Grade}, ")", " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " with ", "Studs @ ", {Property:B1 | STRUCTURE/Studs}, " and ", "Nogs @ ", {Property:B1 | STRUCTURE/Nogs} ) ) ), {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "Existing", ( ( CONCAT ( {Property:CategoryPropertyDefinitionGroup/Renovation Status}, " ", ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), " to remain " ) ) ), {Property:CategoryPropertyDefinitionGroup/Renovation Status} = "To Be Demolished", ( ( CONCAT ( ( SPLITRIGHT ( {Property:ClassificationSystemPropertyDefinitionGroup/CBI Classification - Level 4 - 2019}, " ", 2 ) ), {Property:CategoryPropertyDefinitionGroup/Renovation Status} ) ) ) )