Condition in SW Property Function

Hello

In a property table, I need, depending on a part length, to display a text or another text:

iif ( « testlongueurbarre@test . SLDPRT » > 1000 , 1 , 2 )

If I make the formula with numerical values 1 and 2 as a result, the result is 1 or 2 depending on the test.
but it's not 1 or 2 but text that I want to display

iif ( « testlongueurbarre@test . SLDPRT " > 1000 , " Bar 1 " , " Bar 2 " )

Apart from this returns an error " the syntax of the equation is not correct ", what would be the solution?

Thank you in advance.

Hello
I don't think it's possible directly in the properties. To my knowledge, equations only manipulate numerical values in terms of result and in no way text.
The only solution I see at first glance is to go through a family of Excel parts and do the processing in Excel which is much more likely to do this kind of "calculation".

3 Likes

+1 for the part family, you can always keep your 1-2-3 and in Excel do the test to assign the desired text, and reinject it into SW in Reference bis which will have the text to it.
I take this opportunity to ask from which SW version can we use the equations? in 2019 he is not there.
Thank you in advance.

@FUZ3D the equations were already there in 2010:
https://help.solidworks.com/2010/French/SolidWorks/sldworks/LegacyHelp/Sldworks/Parts/Entering_Equations.htm
It's just that you don't have to look in the right place.
In an assembly or part, tool menu then equation (if necessary add the menu entry):

No it's not that at all, I've also been using them since 2009 :wink: , but it's in the properties, like on Stephd's screenshot. In 2019 we have the choice between numeric or text or date and yes/no, but not equation in the type of data category.

Just a remark, and this is also valid for me, Read the messages well and not what you think you understood :wink: (several of us made the same mistake last week on another post)

1st line after the Hello→ In a property table ... :innocent: