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.

Expression-based properties

Gerald D Lock
Advocate

I need some expert help with expression properties.
I would like to create a property that gives a value which is the zone area divided by 7. The property value should be rounded down to the nearest whole number.
I have tried writing the expression syntax as ROUNDDOWN (Measured Area / 7, 0) but the property manager throws up an error:
the Argument data type is not correct. Argument expects a non-unit value.
Please advise how best to resolve this error.

ArchiCAD 24 (build 5004)

MacBook Pro (16-inch, 2021) Apple M1 Pro 32GB RAM | MacOS 12.0.1



Melbourne, Australia
6 REPLIES 6
Barry Kelly
Moderator

@Gerald D Lock ,

As you are asking a question about expressions in properties, I have moved your post to the main forums rather than leave it as a comment in the article about expression in properties.

That way the article will not be saturated with questions and answers and will remain with just comments about the article.

 

You are trying to round down to 0 (zero) digits which is possibly the problem.

You actually just want the INTeger of the division, but it seems there is no INT function in expressions.

Looks lie you may want to use ... MROUNDDOWN ( Number, Multiple )

Where 'Number' is your division and 'Multiple' would be 1.

 

I think that should work.

 

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

RoundDown takes a number not a area. You must first cancel out the units in RoundDown, that will give you a raw number. If you need a area unit than just multiply in the area unit at the end

ROUNDDOWN ( {Property:Zone/Measured Area} / 7 ft2, 0 ) * 1 ft2

The zero will give you a integer value, but you will still get the same number of digits set in Calculation Unit, They will just be zero

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Further to my previous question, I have two more:

 

1. I'd like to learn how to write expressions for many other applications, but there doesn't seem to be a reference document or clear syntax guide available anywhere - can you point me in the right direction?

 

2. More urgently, I'd like to add a text string to the above expression you assisted with:

ROUNDDOWN ( {Property:Zone/Measured Area} / 7 m2, 0 ) * 1 m2 +"children"

 

Please advise how to append a string to a numeric result.

ArchiCAD 24 (build 5004)

MacBook Pro (16-inch, 2021) Apple M1 Pro 32GB RAM | MacOS 12.0.1



Melbourne, Australia

1. By 'other applications' do you mean for other circumstances?

Have you come across this post.

It seems to have a lot of information and links to the YouTube channel that has a video with different examples.

 

https://community.graphisoft.com/t5/Document-articles/Expression-based-properties-FAQ/ta-p/303797

 

 

2. You will need to convert the numeric outcome to a string and then you can include the extra text.

BarryKelly_0-1673849888706.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

Thanks Barry.

1. Yes, I mean other circumstances.

2. The FAQs page has a lot of helpful information, but I'm still none-the-wiser regarding expression syntax, STR functions etc. because when I follow the links in the FAQs item "I am not familiar with calculations. How could I learn more about expressions?" I hit a 'critcal website error'

 

so, back to first principles, I just Googled "youtube archicad expression properties"

and picked this one as it had a title that seemed most relevant 

How to Create Expression Based Properties in Archicad - Merge Strings (CONCAT)

https://www.youtube.com/watch?v=iQaUKiCC_rc

 

This ^^ was exactly what I needed.

 

As per @poco2013 advice previously, my numeric calculation for the number of children accommodated is:

ROUNDDOWN ( {Property:Zone/Measured Area} / 3.25 m2, 0 ) * 1 m2 )

 

So, I believe the correct expression I require is:
CONCAT ( STRCALCUNIT ( ROUNDDOWN ( {Property:Zone/Measured Area} / 3.25 m2, 0 ) * 1 m2 ), " children" )

 

The weird thing is, when evaluated, the property displays with a single zero-decimal place, eg. a room 7 x 10 I'd expect a result of 21.54 children.

The ROUNDDOWN expression evaluates as expected to 21, however the CONCAT expression evaluates as 21.0

@poco2013 mentioned last time "The zero will give you a integer value, but you will still get the same number of digits set in Calculation Unit" which seems to be what's happening with the CONCAT expression, but it's not clear why this isn't also occurring with the ROUNDDOWN expression.

 

Can you help me remove the decimal point and trailing zero? Changing the Calculation unit accuracy isn't a solution as I still want to see zone areas calculated to a single decimal place.


Classroom zone stamp.pngFunctions-Critical error.pngFAQ-Learn more about expressions.png
ArchiCAD 24 (build 5004)

MacBook Pro (16-inch, 2021) Apple M1 Pro 32GB RAM | MacOS 12.0.1



Melbourne, Australia

So ROUNDDOWN ( {Property:Zone/Measured Area} / 3.25 m2, 0 ) * 1 m2 ) gives you 21 as you want.

 

By multiplying by 1 m2, I think this is converting the number back to m² (a unit value) -  (you divided an area by an area, so you will have just a number now as the result), which then forces you to use STRCALCUNIT to convert a unit to a string.

 

I don't think it is an issue with CONCAT changing it, as that is just joining two strings.

 

The STRCALCUNIT will convert a unit to a string using the calculation units, so that is where it is getting the decimal place.

You say you don't want to change the calculation rules.

So can you use just STR instead.

It may not work as you seem to be converting the number back to m².

 

Without setting it all up myself, maybe try this.

 

CONCAT ( STR ( ROUNDDOWN ( {Property:Zone/Measured Area} / 3.25 m2, 0 ) ), " children" )

 

 

Fingers crossed.

 

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