cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the values in collection object

kngupta141
Participant
0 Kudos

Hi Team,

I am trying search my collection with a particular value, if not found then i want to return the succesful are nor successful.

I found COLLECTION_FIND_BY_STR this function is appropriate for me but how to capture the bolean? I am using this function as execution as execution rule.

Is there any way apart from this? Please let me know your suggestions

Regards,

Gupta

Accepted Solutions (1)

Accepted Solutions (1)

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

Write your execute rule like this:

TYPE

     MyCollection -> First Object Where "SearchFor" Rule is True

SearchFor rule is:

EQSTR

     MyObject -> MyString property

     "SEARCH VALUE"

SearchFor will be executed once for every object in the collection until a match is found by the TYPE function in the main rule.  The first line is the object type contained in MyCollection and the string property we want to search through.  The second line is the string we are searching for.

So, the above will return True if at least one object exists in the collection with the string "SEARCH VALUE" in the MyString property, otherwise False will be returned.

Think of the TYPE function as a WHERE EXISTS.  If the target path contained within TYPE is found, a Boolean True will be returned, and False if not.

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

is this rule correct?

kngupta141
Participant
0 Kudos

Hi Jason,

Does it mean

my action will trigger up on my rule is true

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

Yes, your sub-action action will execute if TYPE returns True.  I don't know your data model, but I assume:

Z_CoachingActivity is the object contained in the Z_Survey collection?

This will return true if it finds a record with the Z_SellerIdPhase property that matches Category.  What is the context of Category though?  Is this another property at the same level of the Z_Property collection?

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

You are right, Z_CoachingActivity is the object contained Z_Survey collection.

we have different phases that contains in survey collection. If the main object seller id phase matches with the survey collection category then i should edit the values. if not add the value to survey collection.

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

So is this solution working for you now?

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

If the rule is false how to make it true

Answers (0)