Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi All
Is it possible to control the number of characters dislayed in a drawing BOM table column that is being fed by model parameter? Complicated I know...
Let's say for example my model has a parameter called PART_CODE and that a number of my models have '-DGN' at the end of the PART_CODE value, e.g. 12345-DGN.
Is it possible in a repeat region to ignore the '-DGN' in any way so that just 12345 is visible?
Thanks for any advice.
Regards,
Neal
All
Just a big thank you to all that replied to my query, especially Donald and Tom...apologies for the delay in summarising.
In the end I went with Tom's solution as it was very comprehensive.
When I delved in a little deeper to my user's actual request it actually concerned some of the system parameters used for BOM information in piping assemblies, not necessarily the user defined parameter we use for part number - but Tom's suggestion still worked a treat.
After re-reading the original post, you could even expand on this so it only removes “-DGN” if it exists at the end of the part code.
(I think I have sufficient error checking for every possible condition.)
Tom U.
/* make sure the parameter actually exists in the component
IF EXISTS("asm_mbr_part_code")
/* make sure the value is at least long enough to extract 4 digits
IF STRING_LENGTH("asm_mbr_part_code") > 4
/* extract the last 4 digits and compare them to "-DGN"
IF EXTRACT(asm_mbr_part_code,(STRING_LENGTH(asm_mbr_part_code) - 3), 4) == "-DGN"
/* remove the last 4 digits from the part code
NUMBER = EXTRACT(asm_mbr_part_code,1,(STRING_LENGTH(asm_mbr_part_code) - 4))
ELSE
/* keep the full part code value if no -DGN
NUMBER = asm_mbr_part_code
ENDIF
ELSE
/* keep the full part code value if length is 4 characters or less
NUMBER = asm_mbr_part_code
ENDIF
ELSE
/* clear the last value for NUMBER in case part code parameter doesn’t exist.
NUMBER = "
ENDIF