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

REPEAT REGION FILTERS

cspinelli
14-Alexandrite

REPEAT REGION FILTERS

Hi everyone,

is it possible to have a filter in a repeat region like this:

if &asm.mbr.name =*X1* then &asm.mbr.name else &asm.mbr.name&asm.mbr&ptc_wm_revision

so, if name is "390972X1" it shows only "390972X1" otherwise if name is "6512453M" it shows "6512453M1" where 1 is revision

thanks!


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.
ACCEPTED SOLUTION

Accepted Solutions
TomU
23-Emerald IV
(To:cspinelli)

Sure. Here are the steps.

1.) Go to "Table", "Repeat Region", "Relations", then select the region in the table.

2.) Expand the "Local Parameters" section of the window.

3.) Create a new parameter to hold the changing value. Let's call it "NAME" (String)

4.) Make sure "ASM_MBR_NAME" "ASM_MBR_PTC_WM_REVISION" are already listed as parameters. If not, add either manually add them (type doesn't matter) or go back out and temporarily add columns with the parameters (this will add them to the parameters list in the relations.)

5.) Add the following relations to the relations section at the top.

IF SEARCH(asm_mbr_name,"X1") > 0

NAME = asm_mbr_name

ELSE

NAME = asm_mbr_name+asm_mbr_ptc_wm_revision

ENDIF

6.) Exit the relations editor.

7.) Change the repeat region parameter in the table cell that currently reads &asm_mbr_name to instead read &rpt.rel.NAME. This may be simpler by right clicking on the cell and choosing "Report Parameter", "rpt..", "rel.", "User Defined", and then type "NAME".

View solution in original post

6 REPLIES 6
TomU
23-Emerald IV
(To:cspinelli)

Filters can use "and" (&) and "or" (|), but not "if' or "then". Instead use repeat region relations to dynamically switch, append, or alter values as necessary.

cspinelli
14-Alexandrite
(To:TomU)

thanks, can you show me a way to do that?

TomU
23-Emerald IV
(To:cspinelli)

Sure. Here are the steps.

1.) Go to "Table", "Repeat Region", "Relations", then select the region in the table.

2.) Expand the "Local Parameters" section of the window.

3.) Create a new parameter to hold the changing value. Let's call it "NAME" (String)

4.) Make sure "ASM_MBR_NAME" "ASM_MBR_PTC_WM_REVISION" are already listed as parameters. If not, add either manually add them (type doesn't matter) or go back out and temporarily add columns with the parameters (this will add them to the parameters list in the relations.)

5.) Add the following relations to the relations section at the top.

IF SEARCH(asm_mbr_name,"X1") > 0

NAME = asm_mbr_name

ELSE

NAME = asm_mbr_name+asm_mbr_ptc_wm_revision

ENDIF

6.) Exit the relations editor.

7.) Change the repeat region parameter in the table cell that currently reads &asm_mbr_name to instead read &rpt.rel.NAME. This may be simpler by right clicking on the cell and choosing "Report Parameter", "rpt..", "rel.", "User Defined", and then type "NAME".

cspinelli
14-Alexandrite
(To:TomU)

THANK YOU VERY MUCH, you saved me!!

another question, is it possible to add another search? like IF SEARCH(asm_mbr_name,"X1") > 0 and SEARCH(asm_mbr_name,"C1") > 0?

Christian,

the operators |, &, !, and ~ extend the use of comparison relations by enabling several conditions to be set in a single statement. For example, the following relation returns TRUE whenever d1 is between 2 and 3, but not equal to 2.5:

d1 > 2 & d1 < 3 & d1 ~= 2.5

So you can use:

IF SEARCH(asm_mbr_name,"X1") > 0 & SEARCH(asm_mbr_name,"C1") > 0

Martin Hanak


Martin Hanák
TomU
23-Emerald IV
(To:cspinelli)

Yes, but... based on your sample numbers above these two will never be true at the same time. I'm guessing you want OR (the pipe symbol), not AND (the ampersand). If you have multiple conditions to check, then you might be better off using multiple IF statements. For example:

/* Set the default value unless altered later

NAME = asm_mbr_name+asm_mbr_ptc_wm_revision

/* Check for "X1"

IF SEARCH(asm_mbr_name,"X1") > 0

NAME = asm_mbr_name

ENDIF

/* Check for "C1"

IF SEARCH(asm_mbr_name,"C1") > 0

NAME = asm_mbr_name

ENDIF

Just realize, the last IF statement successfully entered "wins".

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags