cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a rule for doing a particular action at particular operation?

Former Member
0 Kudos

For one workorder I have multiple operations, for example the length of operation is 10. From operations 1-9 it’s doing type one action and for operation 10 I want to make it do type 2 action. I am trying to create a rule where if its last operation then its true so do action type 2 else do action type 1.  So how do I check either I am at last operation or not? I don’t have any property that keeps track of length of operations, do I have to create one? How do I count and return integer value?

Accepted Solutions (1)

Accepted Solutions (1)

mark_pe
Active Contributor
0 Kudos

Hi Nirali,

Which SAP mobility product are you referring to? Are you talking about SAP Work Manager? In Agentry within SAP Work Manager, you have an Action with steps. For your first 1-9 steps run sub-action1. For the last step run Subaction2.

Action (normally tied your button):

|__Action Steps:

     |__Subaction1 (run against step 1 to 9)

     |__Subaction2 (run against step 10)

Regards,

Mark Pe

SAP Senior Support Engineer

Former Member
0 Kudos

Thanks for the reply, I am fine up to this point where in action I have passed a rule as shown in your response. just a few changes such as " Action (normally tied your button): |__RULE     |__action1 (if operation number = 10 then true)     |__action2 (else false go through operations 1-9 & do action) " The rule is Boolean returns true or false. the question is how do I create a rule to check whether it's last operation. I means is there a way to count & store the length of operation. and then check if it's (length-1).

Former Member
0 Kudos

It's Sap Work Manager, Agentry coding for SAP MP 2.3

mark_pe
Active Contributor
0 Kudos

NP,

I believe there should be a collection count rule (sorry don't have the physical Agentry rule book in front of me right now to tell you the actual command) that checks how many items do you have in your collection. I am assuming you have 10 records for your operation steps (collection). This Agentry rule will return the number of records (ex: 10). Whatever it returns you subtract using Agentry rule math by 1.  Also in dealing with Agentry rule in collection there is an option where it is the last object in the collection or first object in the collection. So if your last operation (last object in the collection) is always a different action then you can write your rule that way.

Regards,

Mark

Former Member
0 Kudos

Even if the operation are worked in any order the (last object in collection) will work? Because the other way to solve it is by checking property1 is true for all operations(means collection of operations for one work order) And property2 is false for one or more operations.

Former Member
0 Kudos

I wouldn't recommend using target the last object in this way, because I have confirmed with Agentry Development they don't "guarantee any order for a collection".  If you where making the objects on the device then last one you made would be the last object.

There is a function in the rule editor called "Count", in your rule you could do something like

GT

- Diff

- - Count

- - - Collection

- - 1

- :>ObjectID

This would return true if the object number (as long it goes 1 to X) is X

Answers (0)