The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
I want to create a model relation that will control a parameter based on the length of a part.
For example IF LENGTH_1 = 255 thru 305 then MAKE_FROM = 12 FOOT. Is there a way to get that to work?
I am just not sure how to go about writing it.
IF LENGTH_1 == 225 THRU 305
MAKE_FROM = 12 FOOT
ENDIF
Solved! Go to Solution.
I would start by setting a default value for MAKE_FROM, and then changing it if LENGTH_1 exceeds a threshold:
MAKE_FROM = "1 FOOT"
IF LENGTH_1 > 25.4
MAKE_FROM = "2 FOOT"
ENDIF
IF LENGTH_1 > 50.8
MAKE_FROM = "3 FOOT"
ENDIF
IF LENGTH_1 > 76.2
MAKE_FROM = "4 FOOT"
ENDIF
...
IF LENGTH_1 > 305
MAKE_FROM = "NOT AVAILABLE!"
ENDIF
etc. This approach is simple, transparent and robust; the final entry handles anything that's too long for a stock size.
You could equally start by setting "NOT AVAILABLE!" and then count down into smaller sizes if the length is suitable, using less-thans.
A 'cleverer' way would be to calculate the required length, round up and form that into a string. It looks like you might be using 3 foot (inch?) increments, so something like
REQ_LENGTH_FOOT = LENGTH_1 / 25.4
REQ_LENGTH_FOOT = FLOOR(REQ_LENGTH_FOOT / 3 + 1)*3
MAKE_FROM = ITOS(REQ_LENGTH_FOOT)+" FOOT"
or you can crunch it all together as
MAKE_FROM = ITOS( FLOOR(LENGTH_1/25.4 / 3 + 1) * 3 ) + " FOOT"
although note that this actually gives "9 FOOT" for 225, and only jumps to 12 from 228.6.
You could still add the "NOT AVAILABLE" clause for robustness...
I would start by setting a default value for MAKE_FROM, and then changing it if LENGTH_1 exceeds a threshold:
MAKE_FROM = "1 FOOT"
IF LENGTH_1 > 25.4
MAKE_FROM = "2 FOOT"
ENDIF
IF LENGTH_1 > 50.8
MAKE_FROM = "3 FOOT"
ENDIF
IF LENGTH_1 > 76.2
MAKE_FROM = "4 FOOT"
ENDIF
...
IF LENGTH_1 > 305
MAKE_FROM = "NOT AVAILABLE!"
ENDIF
etc. This approach is simple, transparent and robust; the final entry handles anything that's too long for a stock size.
You could equally start by setting "NOT AVAILABLE!" and then count down into smaller sizes if the length is suitable, using less-thans.
A 'cleverer' way would be to calculate the required length, round up and form that into a string. It looks like you might be using 3 foot (inch?) increments, so something like
REQ_LENGTH_FOOT = LENGTH_1 / 25.4
REQ_LENGTH_FOOT = FLOOR(REQ_LENGTH_FOOT / 3 + 1)*3
MAKE_FROM = ITOS(REQ_LENGTH_FOOT)+" FOOT"
or you can crunch it all together as
MAKE_FROM = ITOS( FLOOR(LENGTH_1/25.4 / 3 + 1) * 3 ) + " FOOT"
although note that this actually gives "9 FOOT" for 225, and only jumps to 12 from 228.6.
You could still add the "NOT AVAILABLE" clause for robustness...
Oh I like that. I like the way you put it better than what I was trying to do with >= and <=.
Thank you so much
Just put it in and all of that work perfect!