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

read rpt.index as a parameter

RubenPas
9-Granite

read rpt.index as a parameter

My company wants to introduce standard bomballoons values for fasteners.

e.g. A hex_nut_m6 is always number 301.

Now I want to make a repeat region that reads the rpt.index value for all components, but if a component has a parameter called pos_nr, it should obtain that value.

See screenshot, modified in Paint….

I assume this should be possible with relations in repeat regions but I cannot get it to work.

Anybody out there who can help me?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

use repeat region relation:

---

if exists("asm_mbr_POS_NR")

myindex = asm_mbr_POS_NR

else

myindex = rpt_index

endif

Repeat region cell contents:

---

&rpt.rel.myindex

MH


Martin Hanák

View solution in original post

7 REPLIES 7
Chris3
20-Turquoise
(To:RubenPas)

Try:

if string_length(asm_mbr_name)>9

if extract(asm_mbr_name,1,10) == "hex_nut_m6"

Myindex = "301"

else

Myindex = rpt_index

endif

else

Myindex = rpt_index

endif

Then in your repeat region instead of this:

&rpt.index

You will need this:

&rpt.rel.MyIndex

Chris3
20-Turquoise
(To:Chris3)

Looks like I may have missed the second part of the question in regards to pos_nr.

Try:

if string_length(asm_mbr_name)>9 & exists("asm_mbr_pos_nr")

if extract(asm_mbr_name,1,10) == "hex_nut_m6"

Myindex = "301"

else

Myindex = rpt_index

endif

else

Myindex = rpt_index

endif

Then in your repeat region instead of this:

&rpt.index

You will need this:

&rpt.rel.MyIndex

BenLoosli
23-Emerald II
(To:RubenPas)

Are you putting the parameter 'pos_nr' in all of your standard hardware item parts?

Does 'pos_nr' change with the part? Hex_nut_m6 is 301, hex_nut_m8 is 302, hex_bolt_m6x35 is 303, etc.

Do you hardware items have unique part numbers?

Not sure what the length of the asm_mbr_name has to do with anything. Too general of a variable to be useful.

Chris3
20-Turquoise
(To:BenLoosli)

string_length(asm_mbr_name)>9  is a validation check. Without this check if the extract function tries to extract for a component that has less than the number of character you are trying to extract then it will return a NULL. The NULL doesn't report as NULL though it comes back as a blank for that and everything after it which leads the user confused as to what is going on.

I made the assumption that the part file name is hex_nut_m6. If that is not the case then Ruben can obviously adjust as needed.

Hi,

use repeat region relation:

---

if exists("asm_mbr_POS_NR")

myindex = asm_mbr_POS_NR

else

myindex = rpt_index

endif

Repeat region cell contents:

---

&rpt.rel.myindex

MH


Martin Hanák

Do you have any insight on what might prevent this relation from working.  I added the following relation:

 

IF EXISTS ("asm_mbr_item_number")
table_item = asm_mbr_item_number
ELSE
table_item = rpt_index
ENDIF

 

And I reported &rpt.rel.table_item in the table column.

 

But the repeat region did not substitute  the assembly member ITEM_NUMBER parameter for rpt_index.

 

I then tried adding the parameter ASM_MBR_ITEM_NUMBER in the local parameters below the relations but this resulted in all the table items reflecting the last assigned ITEM_NUMBER parameter.  In other words - The first item was 305, the next item was 304, the 3rd item was 303 (as assigned by ITEM_NUMBER) then all subsequent items were also 303 instead of resuming with 1 and automatically indexing from there.

Dear all,

Thanks a lot for the answers.

@Martin Hanak, it functions as required!

Top Tags