2023-11-06 12:15 PM - last edited on 2023-11-07 11:32 PM by Laszlo Nagy
I have a string property "House" as option set with A,B,C as values.
I want to write an expression for the property "FM" like below:
IF
home story =1 AND House = A THEN FM = "A1"
ELSEIF
home story =2 AND House = A THEN FM = "A2"
ELSEIF
home story =1 AND House = B THEN FM = "B1"
ELSE FM="no value"
ENDIF
I tried just a two basic IF - AND expressions but I am doing something wrong...what could it be?
IF ( AND ( Home Story Number = 1; House = "A" ); "1A"; "-" )
IF ( AND ( Home Story Number = 2; House = "A" ); "2A"; "-" )
The first IF sentence decides everything and gives FM=1A for everything on story 1 with House = A but for all others it returns "no value"...
2023-11-06 01:02 PM
With Properties they handle IF differently for multiple conditions. Have a look at THIS.
In your examples you are also using ; instead of a basic , between arguments.
2023-11-06 01:34 PM - last edited on 2023-11-07 11:32 PM by Laszlo Nagy
Got it. Thanx! I did try IFS at first but couldn't get it to work... It was becuse I used too many brackets.
I'd like more examples in the GS learning material...like my code below.
I'm on Swedish Windows and we use ; instead of , (highly irritating when trying to follow international tutorials).
IFS
(
AND ( Home Story Number = 1; House = "C" ); "1C";
AND ( Home Story Number = 2; House = "C" ); "2C"
)
2023-11-06 01:35 PM
Hi,
We could also write it simply like this
CONCAT ( {Property:Généralités/House}; STR ( {Property:Paramètres généraux/Numéro d'étage d'implantation}; 0 ) )
Or better
IF ( ISUNDEFINED ( {Property:Généralités/House} ); "-"; CONCAT ( {Property:Généralités/House}; STR ( {Property:Paramètres généraux/Numéro d'étage d'implantation}; 0 ) ) )