T_Name = extract(asm_mbr_name,1,12) then in your repeat region add &rpt.rel.T_NAME
If you have a filename less than 12 characters, the ITEM column will be null. You will need to write additional relation to correct these conditions.
Operators and Functions for Strings The following operators and functions are supported for strings: ==
Compares strings as equal.
!=, <>, ~=
Compares strings as unequal.
Converts integers to strings. Here, int can be a number or an expression. Nonintegers are rounded off.
Searches for substrings. The resulting value is the position of the substring in the string (0 if not found).
extract(string, position, length)
Extracts pieces of strings.
For example: If param = abcdef, then:
flag = param == abcdef—returns TRUE
flag = abcdef != ghi—returns TRUE
new = param + ghi—new is abcdefghi
new = itos(10 + 7)—new is 17
new = param + itos(1.5)—new is abcdef2
where = search(param, bcd)—where is 2
where = search(param, bcd)—where is 0
new = extract(param,2,3)—new is bcd
Note If you use the itos function on a parameter whose value is zero (0), the return value is an empty string. The following examples illustrate the itos function: integer_param = 4 string_param = itos(integer_param) /*string_param will return 4 */ integer_param = -7 string_param = itos(int_param) /*string_param will return -7 */ For an integer with zero (0) value, the itos function returns a null (") value as shown below: integer_param = 0 string_param = itos(int_param) /*string_param will return an empty or null string (") */ To return a zero string value ("0"), use the following IF statement: integer_param = 0 string_param = itos(integer_param) IF string_param == " string_param = "0" ENDIF
Part Number Shows Descriptive Extension – CAUTION – This works when dealing with piece part assemblies! (The assembly has the same name as a part and the part has been assembled into it.)
• A component name is not the standard name. It contains an extension from a family table or a descriptive extension, such as a cable.
• Retrieve the Generic assembly or assembly. Assure that the following parameters exist PART_TYPE and DESCRIPTION. IF they don’t Create them. Set-Up-Parameters-Create-String PART_TYPE, ASSEMBLY, and DESCRIPTION. If it is an assembly with a descriptive extension PART_TYPE needs to be INST.
• Add a relation to generic assembly Relations-Assem Rel-Add, type:
o generic=extract(rel_model_name,1,14) (or last number is length of characters.)
• For Family Tables:
• Add parameters PART_TYPE and DESCRIPTION to family table. Family Tab-Add Item-Parameter-check PART_TYPE and DESCRIPTION.
• Family Tab-Edit change PART_TYPE to INST for each instance, but not the generic. Modify Description to match its same description for that instance.
• Save file and go back to your drawing.
• The Auto table may have to be deleted and placed again for the correction to appear. Try Table-Repeat Region-Update Tables, first. If it has also effected the Format, it will need placed again.
ADDITIONAL FEEDBACK Basically what you do is write a relation in the repeat region that extracts the first 12 characters of a file name and set’s that value to a parameter (let’s name the parameter shortname). Then you change the column in your repeat region to call that parameter instead of the file name.
The relation could look like this: shortname = extract(mbr_name, 1, 12)
The repeat region column should be set like this: &rpt.rel.shortname (instead of &asm.mbr_name)
Just be aware that if you will have file names that are shorter than 12 characters you would have to play some games with the relation or it will error out.
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.