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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

Calculated Attribute give no results

MartinBach
12-Amethyst

Calculated Attribute give no results

I am using Windchill PDMLink Release 12.0 and Datecode with CPS 12.0.2.13

Hello,
On WTParts I have the parts weight either mapped from associated EPMDocument in an attribute named PRO_MP_MASS or manually typed into an attribute named AttrB. Both are of type Real Number with Units.
I want to make a calculated attribute that have this expected outcome:
- If PRO_MP_MASS has a value higher than 0.1 kg, the value of PRO_MP_MASS should be the result
- If PRO_MP_MASS has no value or is below 0.1 kg, the value of AttrB should be the result
- If both PRO_MP_MASS is below 0.1 or has no value and AttrB has no value, the result should be "No weight assigned".

Used formula: ((!isNull(PRO_MP_MASS) || (PRO_MP_MASS > 0.1)) ? PRO_MP_MASS : ((!isNull(AttrB)) ? AttrB : "No weight assigned"))

What ever combination of values and empty values I make, I get no results in the calculated attribute.
What am I missing?


Here are the errors that I faced
None
ACCEPTED SOLUTION

Accepted Solutions

My mistake was that I created the calculated attribute as a Real Number with Unit type attribute, should have been a String type.
So with that and a suggested formula from cgautier including the unit() function it works:
((!isNull(PRO_MP_MASS) && (PRO_MP_MASS > unit("0.1 kg"))) ? str(PRO_MP_MASS) : ((!isNull(ManWeightSpec)) ? str(ManWeightSpec) : "No weight assigned"))

Thank you
/Martin

View solution in original post

3 REPLIES 3

Hello MartinBach,

Did you review kb article https://www.ptc.com/en/support/article/CS317541 ?

KR,

Charles.

Hello cgautier,
Thank you for your reply.
I had not seen the kb article, but it does not seem to help much.
I simplified the formula to: ((!isNull(PRO_MP_MASS)) ? PRO_MP_MASS : ((!isNull(AttrB)) ? AttrB : "No weight assigned")), but only get a result in the calculated attribute if both PRO_MP_MASS and AttrB are empty.
/Martin

My mistake was that I created the calculated attribute as a Real Number with Unit type attribute, should have been a String type.
So with that and a suggested formula from cgautier including the unit() function it works:
((!isNull(PRO_MP_MASS) && (PRO_MP_MASS > unit("0.1 kg"))) ? str(PRO_MP_MASS) : ((!isNull(ManWeightSpec)) ? str(ManWeightSpec) : "No weight assigned"))

Thank you
/Martin

Announcements
Top Tags