We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-09-08 04:15 AM - last edited on 2022-09-08 04:57 AM by Barry Kelly
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.
2022-09-08 05:10 AM
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.
2022-09-08 06:04 AM
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
2023-01-16 06:59 AM
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.
2023-01-16 07:18 AM
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.
Barry.
2023-01-17 06:25 AM - edited 2023-01-17 06:26 AM
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.
2023-01-17 07:18 AM
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.