Expression to group components?

Expression to group components?

ndamgaard
Participant Participant
533 Views
4 Replies
Message 1 of 5

Expression to group components?

ndamgaard
Participant
Participant

In Ilogic rules, is it possible to create and expression that groups a selection of components, so that all these components can be referenced with one expression (e.g. Component.Isactive(group)=True or False)?

 

To give an idea of what I am trying t

 

--------
component_group
=List("Assembly1", "Assembly2", "Assembly3", "Assembly4",..., "Assembly99")
If statement1=True Then Component.IsActive(component_group)=True If statement1=False Then
Component.IsActive(component_group)=False EndIf --------
I hope it is apparent what I am trying to achieve. Otherwise, let me know.

 

0 Likes
Accepted solutions (2)
534 Views
4 Replies
Replies (4)
Message 2 of 5

theo.bot
Collaborator
Collaborator
Accepted solution

You can use this idea, but you need to add a loop in you code to suppress each component. Here's a small sample:

 

Dim MyGroup = New String(){"P144-00030:1", "P144-00029:2","P133-00210:1"}

For Each oVal In MyGroup
		Component.IsActive(oVal) = False
Next

 

Message 3 of 5

ndamgaard
Participant
Participant

Thanks for the response.

 

It works!

0 Likes
Message 4 of 5

ndamgaard
Participant
Participant
Hello Theo,

A follow up question: Can I reference MyGroup in another rule?

I wish to keep my categories in its own rule, if possible.

0 Likes
Message 5 of 5

theo.bot
Collaborator
Collaborator
Accepted solution

In your main rule you can create a SharedVariable. In other rules you can use this sharedVariable.

so rule1:

Dim MyGroup = New String(){"P144-00030:1", "P144-00029:2","P133-00210:1"}

SharedVariable("MyGroup") = MyGroup

 

Rule2:

For Each oVal In SharedVariable("MyGroup")
		Component.IsActive(oVal) = False
Next