Wishes
Post your wishes about Graphisoft products: Archicad, BIMx, BIMcloud, and DDScad.

Expression 'Skip' Function

poco2013
Mentor
At present, within expressions- version 22 , all parts of the expression must be valid in order for the function (expression) to be evaluated.

The effect of this is to require that within a IF statement that both the TRUE and FALSE paths must be applicable to the object referenced. Therefore there is no way to chain IF statements since a invalid False will abort the IF statement and the TRUE path will never be tested even if it is valid.

As I understand it, this is by design.

Would like to have a 'SKIP' function which would allow the logic to move to a second / third/etc. line of logic as is used (somewhat) in the 'sequence' field.

This would allow a 'backdoor' method to simulate a SELECT statement within expressions and provide additional uses.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
2 REPLIES 2
Barry Kelly
Moderator
Are you sure?
Here is a little expression I made that checks for a certain wall thickness and then checks for various names in the composite structure to give me a construction type ("Face - modular", "Timer frame", etc.) and only if it does not meet any of these requirements will it give a "N/A" result.
So it will continue through the IF statements even when there is not a match.
It is a matter of nesting one IF statement inside another.

IF ( AND ( {Property:Wall/Thickness of the Wall (ARCHICAD 21)} >= 70 mm, {Property:Wall/Thickness of the Wall (ARCHICAD 21)} <= 160 mm ), IF ( FIND ( "face_90", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Face - modular", IF ( FIND ( "face110", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Face - standard", IF ( FIND ( "face", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Face - undetermined", IF ( FIND ( "render", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Common", IF ( FIND ( "plaster", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Common", IF ( FIND ( "common", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Common", IF ( FIND ( "steel", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Steel frame", IF ( FIND ( "timber", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Timber frame", IF ( FIND ( "master wall 100", {Property:General Parameters/Composite Structure}, 1, FALSE ) > 1, "Master wall 100", "N/A" ) ) ) ) ) ) ) ) ), "N/A" )
So simplified I think it will be something like this.

IF ( Logical, ValueIfTrue, IF ( Logical, ValueIfTrue, IF ( Logical, ValueIfTrue, IF ( Logical, ValueIfTrue, ValueIfFalse )))ValueIfFalse )

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
poco2013
Mentor
Hadn't thought of your approach which, in effect, creates a one line expression which, I think, could cause a user to get lost in the logic and would be prone to typing errors which would be difficult to find.

Still think a 'skip' function would be a better approach which would allow multiple lines and would be clearer to the user as to the logic flow and thus be less error prone.

That said, your approach with the resources allowed is a great idea and one I could use immediately.

Thanks so much for the suggestion -- It will help a lot!!!

P.S Curious as to the format of using "Property: General Parameter/Composite Structure" could you fill me in as to its rules for usage. I currently pick from the menus. Is this a alternate method?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27