cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Changing Property Value by Changing Property Option.

Benson Ogayo
Newcomer

Hello,

I need some help. I'm trying to make an expression based property that changes it's value if I change a value from an option set property. I have an option set 'Unit' with options; (M2, M3, M, KG, Item) and another property 'Quantity'. I'd want when I change the "Unit" option to 'M2', for example, The "Quantity" value reads the Area of an element, and if I change to 'M3', the "Quantity" value reads the Volume of the element.

BensonOgayo_0-1667211389579.png

 

I'll appreciate your feedbacks. Kind regards.

1 REPLY 1

JT1986
Contributor

I would use "IFS" statement and start working the expression around that. Also the data type of the expression I would keep as "string" because there are multiple different types of data that expression must be able to handle with one script. 

 

Here's the idea. First "Unit=xx" is a logical condition and second is the the retrieved value determined by the logical condition. Just add other unit types to end of the IFS-script with the  same way as m² and m³.  Also use STRCALCUNIT to handle retrieved values as a string.

IFSIFS

 

In the picture above I also used "concat"-function to join measured value and unit of measurement (as a string) together but that function is not necessary if you don't want to show unit of measurement in the end of the calculated value.

 

Hope this helps!

-JT

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!