We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-06-23 09:24 AM
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.
Solved! Go to Solution.
2023-06-23 09:55 AM
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! 🙂
2023-06-23 09:49 AM - edited 2023-06-23 09:49 AM
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
2023-06-23 09:55 AM
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! 🙂
2023-06-23 10:02 AM
CONCAT (String1, IF (ISUNDEFINED (String2),"", String2))
Architect | Graphisoft Certified BIM Manager
ArchiCAD 27 JPN USA & INT | Windows 10
2023-06-23 10:02 AM
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))
2023-06-23 10:05 AM
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. 🙂
2023-06-23 10:17 AM - edited 2023-06-23 10:17 AM
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.
Barry.
2023-06-23 10:31 AM
OK I completely missed ISUNDEFINED.
Still learning. 😀
Barry.
2023-06-23 10:32 AM
I guess thats the point of the community 😉