We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Collaboration with other software
About model and data exchange with 3rd party solutions: Revit, Solibri, dRofus, Bluebeam, structural analysis solutions, and IFC, BCF and DXF/DWG-based exchange, etc.

IF and CONTAINS expressions example

pb9
Participant

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
Advisor

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. 


GRAPHISOFT CERTIFIED ARCHICAD BIM MANAGER | LinkedIn | My Top Wishes


ARCHICAD 18-27 | BIMcloud Basic | CI Tools | Grasshopper - Rhino | CloudCompare | Bluebeam


Perth, Australia and Tauranga, New Zealand


Windows 10 Pro | Intel Core i9-9900K @3.60GHZ | 32Gb RAM | 2xSamsung S27F350 1920x1080 60Hz | Nvidia Quadro P2200 (5Gb)



Josh Verran
Advisor

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

 

 


GRAPHISOFT CERTIFIED ARCHICAD BIM MANAGER | LinkedIn | My Top Wishes


ARCHICAD 18-27 | BIMcloud Basic | CI Tools | Grasshopper - Rhino | CloudCompare | Bluebeam


Perth, Australia and Tauranga, New Zealand


Windows 10 Pro | Intel Core i9-9900K @3.60GHZ | 32Gb RAM | 2xSamsung S27F350 1920x1080 60Hz | 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