on 04-11-2014 4:21 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
User | Count |
---|---|
79 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.