cancel
Showing results for 
Search instead for 
Did you mean: 

Queries in Agentry Rules

Former Member
0 Kudos

Hi Friends

I have a requirement like, Based on ItemType we need to display values like Product ID, Description and Quantity

My logic is like below

if(ItemType.equals("ZSPF")||ItemType.equals("ZSPI")||ItemType.equals("ZSPR")||ItemType.equals("ZSPN")){

  log.info("ItemType is"+ItemType);

  multiMap.put("Product ID", Product ID);

  multiMap.put("Description ", Description );

  multiMap.put("Quantity", Quantity);

  }

Same thing i need to achieve using Rules,

Please help me

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Based on ItemType we need to display values like Product ID, Description and Quantity


These values are in Item Collection under Service Order Object

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Vignesh,

I am not sure exactly what you are trying to accomplish here.  Can you please elaborate?

What type of rule do you need to write?  Enable? Update?

Are you trying to populate fields on the screen only in certain conditions?

--Bill

Former Member
0 Kudos

Thanks Bill,

I am trying to pass Item values to Java code as an Argument.

I have created a Edit item transaction with a rule

In the rule, i am using concatenate function to get item values such as

1. ItemType, Product ID, Product Description and Quantity

we have a logic to filter ProductId, Description and Quantiy based on ItemType

Please see the screenshot. I need a logic like this

if (itemType=ZSPF){

ProductId

Description

quantity

}

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

So it sounds like what you are looking to do is loop over a collection and if the values match your rule then execute the transaction.

So you need to define a looping subaction and write the rule to return true or false depending on if you want the current record included and if so the action steps would execute to populate the property.

--Bill

Former Member
0 Kudos

Bill, Exactly i needed like this

I am looping over item collection and fetch the values

IF

ItemType value matches ZLBF or ZSGM or ZKLF

then no need to fetch Product ID, Description and Quantity

for other ItemType values, i need Product Id, Desc and Quantity

I tried the condition IF, but after it is asking some condition1, But there am not able to select values like below

:>Current Object>"ItemType" Property = "ZLBF"

Can you please tell one example, How to write subrule for this condition ?

Former Member
0 Kudos

Bill I Tried like this

1. Created a Global Variable for condition like below

ItemType.equals("ZSPF") || ItemType.equals("ZSPI") || ItemType.equals("ZSPR")|| ItemType.equals("ZSPN")

2. Another Global Variable has boolean Value

3. Then in Concatenate Function, i added this sub rule like below

Concatenate

if

global variable

True

ProductID

desc

Quantity

But this is not working, am i missing anything ?

jason_latko
Advisor
Advisor
0 Kudos

Vignesh,

Bill asked me to help with this.  Since you are looping over Item objects, you don't need the "current object" syntax.  You can't use the if condition that you wrote here: "ItemType.equals("ZSPF") || ItemType.equals("ZSPI") || ItemType.equals("ZSPR")|| ItemType.equals("ZSPN")".  Agentry doesn't understand that syntax.  You need to use Agentry functions to do the same thing:

IF

     OR

          EQSTR

               ItemType Property

               ZSPF

          EQSTR

               ItemType Property

               ZSPI

           EQSTR

               ItemType Property

               ZSPR

           EQSTR

               ItemType

               ZSPN

     CONCATENATE

          ProductID Property

          Description Property

          Quantity Property

     OR

          EQSTR

               ItemType Property

               Something Else

     CONCATENATE

          Something Else

     CONCATENATE

          Neither is True

The above checks if Itemtype is ZSPF or ZSPI or ZSPR or ZSPN and returns a string with ProductID + Description + Quantity.  Else if ItemType = "Something Else" then we return a string with "Something Else". Else if neither is true, we return a string with "Neither is True".  All the hard coded string values are hand typed constants.

Jason Latko - Senior Product Developer at SAP