Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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!
Solved! Go to Solution.
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".
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.
thanks, can you show me a way to do that?
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".
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
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".