cancel
Showing results for 
Search instead for 
Did you mean: 

How to make this update rule in Agentry

kngupta141
Participant
0 Kudos

Hi All,

Here is my object looks like for example.

A  Object

x1 properties

x2 properties

x3 properties

Y property (transaction type)

id  property(seller id phase)

B is the collection

     b1 property

     x   property

    

i want to populate the values of x in x1 if b1 property and id property with current screenset values matching

Regards,

Gupta

Accepted Solutions (1)

Accepted Solutions (1)

jason_latko
Advisor
Advisor
0 Kudos

Nagaraja,

I'm not following your requirement.  Can you please be more specific?  B is a collection within the A object?  What do you mean by x1 properties, x2 properties?  Thanks,

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

B is the collection in A  and  X1, X2 and X3 are the string properties in A Object.

Ignore about X2 and X3 Properties for time being. How to we write this rule? to populate the X1

Regards,

Gupta

kngupta141
Participant
0 Kudos

Hi Jason

what function i have to use to return a particular field value from a collection which is found by my search criteria?

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

Still not quite following the requirement.  You want to search all the records in collection B for a match, or will there just be one record in B?  Trying to search through multiple records in collection B using an update rule will be terribly ineffiecient and slow.

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

At max the collection will have only 20 records. Do you think still it will be performance issue? if yes i will take this point into consideration.

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

You could do it like this:

Assume object B has string fields: key,target.

Screen has a field called SearchFor, and a field called UpdateMe that you want to update with your rule.

Update rule on screenfield UpdateMe is:

Object A -> Collection B -> Find First Object Where rule SearchB is True -> target property

SearchB rule is:

EQSTR

     B Object -> key

     MyScreenset -> Current Screen -> SearchFor field

The update rule will search through all B Collection records looking for the first row that has a key property that matches the SearchFor field on screen.  It will then return the target property of the matching row and update the UpdateMe screen field with that value.

This update rule will happen each time something changes on screen, so be careful about looping over many records this way.

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

Small changes in this

A  Object

x1 properties

x2 properties

x3 properties

Y property (transaction type)

id  property(seller id phase)

B is the collection

     b1 property

     x   property

     id  property(seller id phase)       This data exist here as well along with object

So now i am looking for b1 property in my collection with the current screen value of b1 and if id matches i want to return the x value.

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

You are on the right track.  You still want your update rule to say:

Object A -> Collection B -> Find First Object Where rule SearchB is True -> x property

In your screen shot, remove the IF and use a single AND with the two EQSTR checks.  This rule returns a boolean, so you don't need the IF.

Jason Latko - Senior product developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

I don't need Boolean i want to return x property value if my condition satisfies.

The above screen is the rule for this (Find First Object Where rule SearchB is True)

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

Yes I am following you.  You do need the search rule to return a boolean.  That is how the search works when looking for the matching b object.  The original update rule tells Agentry which property to return from the collection once the object is found:

Object A -> Collection B -> Find First Object Where rule SearchB is True -> x property

Notice the last part of the above rule.  This will return the x property of the b object that is found using your search rule.  The search rule is used only for finding the matching row, not returning any values from the row.

Jason Latko - Senior Product developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

I got struck here,

In this update rule i am calling this Rule search.

Could you please tell me what i have to do now to get the X property.

Regards,

Gupta

jason_latko
Advisor
Advisor
0 Kudos

Gupta,

Here is your update rule:

Use the object browser to set it up like this:

Object A -> Collection B -> Find First Object Where rule SearchB is True -> x property

Jason Latko - Senior Product Developer at SAP

kngupta141
Participant
0 Kudos

Hi Jason,

Thank you,

Now i got it

Regards,

Gupta

Answers (0)