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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Parameter value display in BOM tables

nhanratty
2-Guest

Parameter value display in BOM tables

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


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
5 REPLIES 5

One way is to make a new parameter called short_part_code and use a relation

short_part_code=extract(part_code,1,9)

Change the number 9 to the number of characters you want to keep.

Bill Chapman
Email: -<">mailto:->
Tel: 708-496-3100 | Cell: 708-205-5705

[cid:image001.jpg@01CF296A.A86383C0]

Neal,

If all your parts have the same number of digits use Bill's method.

If you have some that are longer there is a way to use relations without using the 'extract'.

IF asm_mbr_part_code == "12345-DGN"
number = "12345"
ELSE
number = asm_mbr_part_code
ENDIF

Then change the repeat region column from asm.mbr.part_code to rpt.rel.number.

(The term "number" ends up being a parameter created inside that repeat region, so you can change that to whatever you'd like.)

If you have multiple numbers you need to truncate I can forward an example of that, too.

TomU
23-Emerald IV
(To:nhanratty)

You can also use a combination of the two methods. Keep the relations in the repeat region (like Donald suggested), but use the "extract", "search", and "stringlength" functions (similar to what Bill suggested) to strip the portion you don't want displayed.

IF EXISTS("asm_mbr_part_code")
NUMBER = EXTRACT(asm_mbr_part_code,1,(STRING_LENGTH(asm_mbr_part_code) - 4))
ENDIF
TomU
23-Emerald IV
(To:nhanratty)

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

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

Top Tags