We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2024-04-04 05:50 AM
Hi,
I am dabbling in Expressions. I'd like to convert the Story Number to a Letter for some storeys, and others to remain unchanged i.e.
Story Number 0 converts to B2
Story Number 1 converts to B1
Story Number 2 converts to G
Story Number 3 (and above) unchanged.
I have worked out how to change 0, 1, and 2 to B2, B1, and G, but can't work out how to return the Story Numbers above this as unchanged. When I evaluate something on Story Number 4, "Evaluate..." returns <Undefined>.
This is the expression :
IFS (
CONTAINS ( "1", STR ( {Property:General Parameters/Home Story Number} ) ), "B2",
CONTAINS ( "2", STR ( {Property:General Parameters/Home Story Number} ) ), "B1",
CONTAINS ( "3", STR ( {Property:General Parameters/Home Story Number} ) ), "G" )
Any ideas?
Thankyou 🙂
Operating system used: Windows
2024-04-04 06:43 AM
Can't you just give the storeys a name and use that?
Or do you need a different name for other purposes?
Barry.
2024-04-04 07:04 AM
Hi Barry,
We give the storeys intuitive names like Ground, Level 1, Level 2, Roof
To create unique codes for Doors + Windows in Apartment / Room Modules we include the Story Number in the Label. Using the storey name would be too long... a short code is needed. These codes becomes a bit confusing when the tag displays 0 for Ground, -1 for B1 or -2 for B2 for example - so trying to do above conversion.
As well, sometimes our Story Numbers don't relate i.e. Level 7 may be on Story Number 5 - we use some arithmetic operators in the Expression so the code in the door relates to the storey it is on...
What are your thoughts?
2024-04-04 07:24 AM
If you are not using the intuitive names for anything, I would just change them to G, B1, etc.
Otherwise in your expression, you would have to convert all of the other storey numbers to text as well, 4 = "4" , 5 = "5".
i.e. continue your IFS statement ... CONTAINS ( "4", STR ( {Property:General Parameters/Home Story Number} ) ), "4"
This will only work in this case up to 9 storeys.
Storey 10 will also be evaluated as "B2" because it contains "0".
Barry.
2024-04-04 07:30 AM
We typically name views by the Project Map, so these names become visible in Titles and is clearer as full name..
Hmm OK - was hoping that was not the case.
There is no way to do something like... apply this expression for B1, B2, G but for all others just print the Home Story Number? Can the Sequence function be used in any way?
Thanks for the response
2024-04-04 07:37 AM
@jimmynimmy wrote:
There is no way to do something like... apply this expression for B1, B2, G but for all others just print the Home Story Number? Can the Sequence function be used in any way?
Not really.
You are creating a 'string' property for storeys 0, 1 & 2 (B1, B2 & G).
So you will need to also convert all the other storeys to also have the same string property equivalent.
Even though it will look like a number, it will be a 'string' (text version) of that number.
You will need to do the conversion for each storey.
Barry.
2024-04-04 11:28 AM
Hi
you could try the following addition to your expression to achieve a result.
But have a look at the screenshot below for the outcome and change your expression accordingly:
IFS (
CONTAINS ( "1", STR ( {Property:General Parameters/Home Story Number} ) ), "B2",
CONTAINS ( "2", STR ( {Property:General Parameters/Home Story Number} ) ), "B1",
CONTAINS ( "3", STR ( {Property:General Parameters/Home Story Number} ) ), "G",
TRUE, STR ( {Property:General Parameters/Home Story Number}, 0 ) )
2024-04-04 12:47 PM
Hi,
Here is another formula possibility using the floor number directly
Sorry formula in French
IFS ( {Property:Paramètres généraux/Numéro d'étage d'implantation} = 0; "B2"; {Property:Paramètres généraux/Numéro d'étage d'implantation} = 1; "B1"; {Property:Paramètres généraux/Numéro d'étage d'implantation} = 2; "G"; OR ( {Property:Paramètres généraux/Numéro d'étage d'implantation} < 0; {Property:Paramètres généraux/Numéro d'étage d'implantation} > 2 ); STR ( {Property:Paramètres généraux/Numéro d'étage d'implantation}; 0 ) )
2024-04-11 01:26 AM
Thanks everyone..
I ended up doing below, where Storey 3 here is Ground :
CONCAT ( IFS ( {Property:General Parameters/Home Story Number} = 3, "G", AND ( 3 < {Property:General Parameters/Home Story Number}, {Property:General Parameters/Home Story Number} < 13 ), CONCAT ( "L0", LEFT ( RIGHT ( STR ( {Property:General Parameters/Home Story Number} - 3 ), 4 ), 1 ) ), {Property:General Parameters/Home Story Number} >= 13, CONCAT ( "L", STR ( {Property:General Parameters/Home Story Number} - 3, 0 ) ), {Property:General Parameters/Home Story Number} < 3, CONCAT ( "B0", LEFT ( RIGHT ( STR ( {Property:General Parameters/Home Story Number} - 3 ), 4 ), 1 ) ) ) )
This works more generally, so anything above Storey 3 will include an L infront. Storey 3 will be called G. And anything below will include a B infront (but only works to B09)
@Xandros How did you create that table?
2024-04-11 08:52 AM - edited 2024-04-11 08:54 AM