Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Creo 3, M070
I'd like to use two conditions to filter a repeat region, can I do this?
What I mean is that I want to filter all assemblies out of my region except the ones with the parameter BOM_DISPLAY set to YES. So, I'd like to display assemblies only if these two conditions are met:
&asm.mbr.type == ASSEMBLY*
&asm.mbr.bom_display == yes
But, I believe that if I put those tow things in the repeat region filters the only items I'll get are those assemblies. I'd like to get all the parts too (except skeletons and parts where BOM_DISPLAY is set to no).
So, what I want is:
&asm.mbr.type != SKELETON*
&asm.mbr.bom_display != no
&asm.mbr.type != ASSEMBLY*
EXCEPT where:
&asm.mbr.type == ASSEMBLY*
AND:
&asm.mbr.bom_display == yes
Of course, that's not going to work. How can I accomplish all of this?
Solved! Go to Solution.
Doug,
I created test data in CR2 M070 (repeat_region.zip). Unzip it, investigate it and apply it to your real data .
In Relations dialog box I had to create two highlighted parameters manually (as String parameters).
MH
Try:
&asm.mbr.type == ASSEMBLY, PART
&asm.mbr.bom_display == YES
A nuance that I failed to mention is that not all parts or assys have the BOM_DISPLAY parameter. Right now, only the parts that I want to exclude do.
The more I think about this, I'm thinking that rules to exclude skeletons and the parts that I never what to show (parts of a purchased sub assy) plus then manually filtering the rest makes the most sense in this case.
I would suggest using repeat region relations to set a parameter that can be used by the filter to determine whether or not to show each row. Take a look at this discussion: REPEAT REGION FILTERS
I agree with Uminn's suggestion -
In the table relations try:
if exists("asm_mbr_bom_display")
test = asm_mbr_type == ASSEMBLY* & asm_mbr_bom_display == yes
endif
And then the filter is &rpt.rel.test ==TRUE (or False .. I've lost track)
(edited to use underscores instead of periods.
For those dealing with Repeat Regions, underscores replace periods as field separators in relations, but not in filters or in repeat region cells.
However, relations don't use the ampersand prefix that is required in cells and in filters.)
Another option, if you have it, is to use Modelcheck to add the parameter to the models that don't already it. The filters above would then work.
Maybe you need second BOM
Doug,
I created test data in CR2 M070 (repeat_region.zip). Unzip it, investigate it and apply it to your real data .
In Relations dialog box I had to create two highlighted parameters manually (as String parameters).
MH
I'm marking this as correct even though I've already gone with manual filtering for my application. This does look like it would do exactly as I want, though.
Hi Martin,
I have been searching for this solution from last couple days and finally I found something that matches my requirement. But I'm completely new to the environment (Creo), could you pls pls explain with a step by step process (i.e., Screenshots or whatever you feel that you could). I really can't express the knowledge sharing you are doing at this point. I do downloaded the zip file but pls go through the process once again.
Dan
Hi,
I am sorry I cannot teach you how to work with Repeat Region, please go to http://help.ptc.com and look into Creo Help center.
I can help you if you create parts, assembly, drawing and do what your are able to do. Then you can upload your data and ask question.
Thank you so much Martin for you timely response. I really appriciate your time. I'm quite new to the Creo environment & coding too but have interest for learning it. so bascially, I'm looking for some pictorial examples ratherthan verbal explanation, as I'm not completly aware of this environment (its my bad to have poor exposer to creo). I prepared a document of what I did so far & also what is my end goal and I'm attaching it along with this message. I do attached the Creo files in this message, please have a look & let me know if you need any further information
I wasn't able to attach more than 1 file along with the response, so I'm adding the creo files along with this message.
Two errors:
1) You cannot change a model parameter inside a repeat region relation
2) You cannot change any parameter using "==" which is the logical equality comparison operator.
You need to create a new repeat region parameter inside the relations if you want to have the relations control a value to be displayed in the repeat region. It will be displayed in the repeat region using "rpt.rel.parameter_name" where you substitute the name you chose to create for the 'parameter_name'
Thanks for the Response dschenken.
So, I'm not suppose to create the "SALVAGININ_1" parameter inside the model if I want to control the BOM. I have to create it within the Table > Repeat Region > Relations > selected the Level_1 region > Local Parameters > SALVAGININ_1 & have to implement the relation rpt.rel.SALVAGININ_1 - Right ?.
But, How can I control the parts without Implementing the parameter to those parts ? Can you go with little more details
Look at the relation you posted. Then look at what I wrote.
Take some time to think about what the relation was set to do.
The relation was trying to set PART_ID to a new value. This cannot happen inside a repeat region relation.
Hi,
to remove items from repeat region which have SALVAGININ_1 parameter set to NO, you can use filter functionality. See attached drw0002.drw.
> activate Table tab
> click Repeat Region button
> click Filters command
> click By Rule command
> click Show command
You will see following filtering rule in 1st level repeat region and in 2nd level repeat region.
&asm.mbr.SALVAGININ_1 == true
Please note that setting SALVAGININ_1 value to NO for 2nd level sub-assembly automatically remove all its components from repeat region.
The purpose of repeat region relations is something like ...check values of existing model parameters and define repeat region internal parameter using model parameters values. Repeat region internal parameter can be displayed in repeat region cell using notation &rpt.rel.paramname.
if you don't mind can you share a video, sir? I tried but it's can't work.
@Amirtharaj_K wrote:
if you don't mind can you share a video, sir? I tried but it's can't work.
Hi,
I am sorry I do not understand what did you try and what did not work.
This solution is terrible for parameters that are non binary. Why can't we simply use an "AND" expression for two conditions in a filter?
Allow me to give an example. If I have a component family that has 5 styles (1,2,3,4,5) and 4 options (A,B,C,D)
Style == (1,2,3,4,5)
Option== (A,B,C,D)
If I want to create a table that filters out a few of them lets say all parts that are style 1 and have option A. I have to create another parameter "DISPLAY" or whatever and create a complicated conditional relation to set various combinations.
Display == 1A, (if style ==1 and option==A) ...
1B
1C
1D
2A
2B
etc..
That seems like a ridiculous amount of work just to create a table that filters a table with 2 conditions.
Does anybody know a better way. This seems like something that would be easy to program with an AND / OR statement in a filter.
To a limited extent you can actually use and and or statements. For example:
The method above also works with other attributes and even company attributes/parameters...like description, etc
The main problem I am running into is that the or method using commas all must be on one line, but only allows for so many characters on that line before it errors and won't accept the code at all. Given this limitation, it seems that I need a way to express OR statements across multiple lines. I may need to resort to creating an extra parameter in relations and then filter by that one (as I did create a test table that did this), however I would rather filtering stay in filtering, and relations stay in filtering...seems cleaner and easier to troubleshoot.
Does anyone know how to continue to the next line in repeat region filtering code?
Another problem I run into using the above method is that I don't know how to adapt it to use multiple parameters on the OR line (for example if I wanted to filter by description OR P/N OR etc).
Also, the other reason I don't want to do filtering in the relations is that wildcards very much complicate the coding. For example, if I wanted to filter by *BACK*UP* to account for BACKUP and BACK-UP, I think that would have to be done with 2 search functions and a nested if statement...now if I wanted to throw AND functions in there it would turn a one line filter into many lines...unless I am missing something.
like this?:
Very good~!!!
If the component is not too much
Like this:
Asm create a parameter: bom_display=no
Filter:&asm.mbr.bom_display !=no
This is faster.
Hi Doug,
I have a similar situation, but I need to use an OR condition in my filter.
I want my BOM to include all assembly members (&rpt.level < 2) OR any sub-component with a custom parameter (&asm.mbr.BOM_DISPLAY == YES)
Do you know how I can accomplish this? Thank you!
Spencer
Please disregard - I was way over-complicating it. I just discovered the Flat/Rec Item button in the repeat region menu. It does exactly what I need.