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

Documentation
About Archicad's documenting tools, views, model filtering, layouts, publishing, etc.
SOLVED!

Property with expression and IF statement

ATS
Booster

Hi

 

I'm not skilled enough with the expression tool or code to understand how my expression should be set up and hope someone can teach me:

 

I have 2 "String" value properties that I want to merge, in a new property, but be blank or " " if not both values are defined.

 

String1 has a default value - Value "ABC" that should always be there.

String2 has Default value - Undefined and should be filled in as needed

 

So far I've set up the Expression like this:

CONCAT ( String1; String2 )

 

This works well if both values are defined, but leave a "---" as autotext if I don't fill in a value for String2.

Is there a way to add a IF function that says

 

"if String2 = undefined " " else CONCAT ( String1; String2 )"

 

That way the --- would be hidden for a blank space if the value is not filled in yet.

Thank you for any help.

AC28 NOR 3001 (WIN)
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Thank you for the quick reply. The suggested line adds String1 before considering if String2 is undefined, but I managed to just do the CONCAT inside IF instead of IF inside CONCAT to fix that.

IF(ISUNDEFINED (String2);"";CONCAT (String1; String2))

You helped me with the right puzzle pieces and I got it working so thanks again! 🙂

AC28 NOR 3001 (WIN)

View solution in original post

8 REPLIES 8
Xandros
Advisor

Hi,

 

CONCAT(String1; IF(ISUNDEFINED (String2);"";String2))

 

 

you can directly use the IF-Formula inside of the CONCAT. Hope, this works for you - otherwise it needs some adjusting in the condition-part of the IF

ArchiCAD 27 GER / Win10
Intel i9-9900K / 64GB RAM / nVidia GeForce RTX 2080 Ti
Solution

Thank you for the quick reply. The suggested line adds String1 before considering if String2 is undefined, but I managed to just do the CONCAT inside IF instead of IF inside CONCAT to fix that.

IF(ISUNDEFINED (String2);"";CONCAT (String1; String2))

You helped me with the right puzzle pieces and I got it working so thanks again! 🙂

AC28 NOR 3001 (WIN)
kmitotk
Advocate

CONCAT (String1, IF (ISUNDEFINED (String2),"", String2))

Kei Mito

Architect | Graphisoft Certified BIM Manager
ArchiCAD 27 JPN USA & INT | Windows 10

Xandros
Advisor

You're welcome 🙂

 


@ATS wrote:

 

String1 has a default value - Value "ABC" that should always be there.


If String1 needs to always be there, i feel like your code needs to be adjusted slightliy:

IF(ISUNDEFINED (String2);String1;CONCAT (String1; String2))

 

ArchiCAD 27 GER / Win10
Intel i9-9900K / 64GB RAM / nVidia GeForce RTX 2080 Ti

I can see that I worded that badly. I meant that it should always be in the Value and the same any time its used, but for my CONCAT expression I want there to be " " if String2 is undefined and "String1String2" if both are defined. 🙂

AC28 NOR 3001 (WIN)
Barry Kelly
Moderator

I am not sure if you can check if a property is "undefined".

At least I couldn't get it to work.

 

But if you give it an empty default value you can do this.

 

BarryKelly_0-1687508143224.png

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

OK I completely missed ISUNDEFINED.

Still learning. 😀

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

I guess thats the point of the community 😉

AC28 NOR 3001 (WIN)