cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Collaborate forum

IF and CONTAINS expressions example

pb9
Newcomer

Hi all,

 

I'm quite new having just switched from Revit to Archicad and I want to learn more about expressions. I'm struggling here with this. I'd like to write an expression to take the Zone (element ID) and if it contains "EX" in it I want it to return 0 and if not, return the area.

 

I'd also like to write an expression that says if the zone says "EX" then exemption says "SMC 23.45.510.D.10". As of right now, I've just copied and pasted.

 

If any of you know of resources where I can learn more about expressions, I'd greatly appreciate it. Thanks


Screen Shot 2021-11-16 at 3.35.59 PM.png

3 REPLIES 3

Josh Verran
Expert

Hi there

 

I'm sure one of the other more experienced users can solve this for you with more details.

In the interim thou something like this might be a start.

 

IF(Zone Name = "Ex","0","Other Text")

 

Since your values don't actually = Ex they contain Ex, I think you will need to replace the bold text above with a "Contains" function. 

ARCHICAD 18-25 | BIMcloud Basic | CI Tools - CI Extension by Central Innovation | Windows 10 Pro | Intel Core i7-6700K @4.00GHZ | 32Gb RAM | Dual Samsung S27F350 1920x1080 | Nvidia Quadro P2200 5Gb

Josh Verran
Expert

Actually you could try this, have one property that extracts the first two characters of a property (in this case that would be extracting "EX").

Then have another property that says if property = "Ex", then show the text you mentioned, if not then show 0.

 

Below will hopefully help. I have used a property called "Name/Type" where as yours would probably be the zone name.

 

I'd be interested to see how the Contains function could be utilised, I tried by saying if the text contained EX then return a True or False result, but then I couldn't use that as an argument in the original expression as had different data type. You could probably convert that to text, but I'm sure theres a simpler method. Cool to have a play around and find different methods to extract info.

4.png1.png2.png

 

 

ARCHICAD 18-25 | BIMcloud Basic | CI Tools - CI Extension by Central Innovation | Windows 10 Pro | Intel Core i7-6700K @4.00GHZ | 32Gb RAM | Dual Samsung S27F350 1920x1080 | Nvidia Quadro P2200 5Gb

Rico
Booster

This could be simplified more by using a STRING FROM LEFT function inside an IF statement to find the first two letters and return a specific result if it contains 'EX'.

 

IF ( LEFT ( Zone Name, 2 ) = "EX", "SMC 23.45.510.D.10", "" )

 

And for the area:

 

IF ( LEFT ( Zone Name, 2 ) = "EX", 0m2, Measured Area )

 

Only one property is needed for each with this method.

 

There is a lot of information about functions in the online reference guide which I've found very useful - https://helpcenter.graphisoft.com/user-guide-chapter/86540/

iMac 27" 5K • macOS 10.15.7 Catalina • 40GB RAM | ArchiCAD 24 5004 FRA
Ryzen Threadripper 3970X • Windows 10 • 64GB RAM | ArchiCAD 24 Solo UKI

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!