cancel
Showing results for 
Search instead for 
Did you mean: 

Agentry: @COLLECTION_FIND / @COLLECTION_FIND_BY_STR function in Agentry

Former Member
0 Kudos

Hi,

Can anyone show me how to implement the @COLLECTION_FIND / @COLLECTION_FIND_BY_STR function in Agentry?

I did try it for a custom work manager mod but am unable to get this function to work.

I did look at the documentation already but a sample implementation would be really helpful. (A sample screenshot in the rule would be helpful)

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

A simple implementation which I did that didn't work (no values output in the message text).

jason_latko
Advisor
Advisor
0 Kudos

Samuel,

For what purpose are you trying to use this function?  What is your goal?  Trying to display the FROM_STRING there probably will not display anything, since that function returns a pointer to the object itself.  If you are just trying to check for the existence of a record based on criteria, use the TYPE function.  You could wrap your existing rule (without the FROM_STRING) in the TYPE function.  TYPE acts as a WHERE EXISTS check for target paths, so if your COLLECTION_FIND returns a record, TYPE will return TRUE, else FALSE:

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Thanks Jason.

I was just trying to see if there's a message output (an experiment and am triggering it from a button).

Will try the type function.

Cheers,

Sam

Former Member
0 Kudos

Hi,

I have the same problem.

In equipment object I have a custom property as ZBARCODE. In this property, I scan a barcode value and it must be unique as EquipmentID. Because of the fact that in EquipmentEditForAdd transaction, key property is EquipmentID, I need to create a control for ZBARCODE value uniqueness on offline mode. I mean, I have a control for equipments which were transmitted to ERP side (so they are in ctEquipment complex table). But in offline mode, while I am adding equipment, I need to check every equipment barcode value but they are not stored in complex table until transmission.

So I created a validation rule in EquipmentEditForAdd, here is the structure.

I tried the EquipmentWorkList because I check my settings on blackberry platform, it is easy was for me for checking transaction and object values. I noticed that when I add an equipment, it apeears in EquipmentWorkList property as below:

Could you please help me?

Best regards,

Mina

jason_latko
Advisor
Advisor
0 Kudos

Mina,

Try something like this:

Substitute your ZBARCODE where I used description.  The above rule will check each record in the EquipmentWorkList collection, looking for an Equipment Description that matches the current transaction's Description property.  The Equipment fully qualified object name value is necessary so Agentry knows to what context our variables belong.  If we do not find one, the validation rule will pass.  I did not test this, but believe it should work for you.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Jason,

Thanks for you quick response and help.

Here is my rule as you defined:

When I tested it, I got validation error message in every case. For each barcode value I got error.

I will keep to try some changes on this rule, if I achieve, I am going to share with you. In the same time if you find any workaround or solution please inform me.

Best Regards,

Mina

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Mina,

You should really create a new Discussion marked as a Question.  Not only so others may benefit from your solution once it is found, but also because you will have more folks looking to provide a solution when your issue has the greater visibility of a Discussion.  Also suggest that you visit the Getting Started link at the top right of each SCN page for help with creating a good Discussion.

--Bill

jason_latko
Advisor
Advisor
0 Kudos

Mina,

Try debugging the rule using the built in Eclipse Test Environment for Agentry.  It is a WPF client with debugging capabilities.  You can turn on rule debugging (use low importance as the log level), and then view the log after the application validation rule runs to see the output from the rule.  This will help you debug the rule to see why it isn't working properly.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Thanks a lot for your helps Jason.

mark_pe
Active Contributor
0 Kudos

Jason,

Thanks for the assist.

Regards,

SAP Mobile Support Team.