cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning list of values to a variable in Agentry

Former Member
0 Kudos

Hi All,

I have a requirement which revolves around iterating a collection of Measuring Points for the Rounds Manager Application and picking up only those which have their reading field as empty. As I loop over these Measuring points which have the reading as empty, I also need to populate them in a field which will later be used for a different purpose.

For example: Out of three Measuring points - MP001,MP002,MP003 the reading is empty for MP002 and MP003. In this case I would like to have my custom field to have the values MP002 & MP003.

As a matter of fact, I had explored the option of setting something in a global variable, but not sure how global variables can be accessed so as to assign values to it dynamically. I also thought of using rules for this, but not sure if assigning values is possible through rules.

It would be great if someone could help me with this.

Thanks

Arpan

Tags edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert

Arpan,

Globals in the Editor are really more constants.  Their value cannot be updated at runtime.

I would suggest using a property on the Main Object.  You will also need to create an action that will have a sub action step to loop over the collection (with an include rule based on if the reading is empty) and have the subaction execute a transaction each time a match is found to append the current object id to your new main object property.

Depending on your business requirement you may also want to start the action with an edit transaction to clear out the main object property before the loop begins executing.

--Bill

Former Member
0 Kudos

Hi Bill,

In that case, do you mean to say that every time we need something to be globally accessible and which might need updation on a dynamic basis can only be done via a property of the main object?

You mentioned something about appending the object id to the main object property. How can this be done in Agentry? Could you explain a bit more on this ?


Thanks

Arpan

jason_latko
Active Contributor
0 Kudos

Arpan,

Like Bill mentioned, we typically keep temporary variables or variables that need to be globally accessible with dynamic values in the main object.  Just create a main object transaction to update these via an action.  To handle your scenario where you want to keep track of a list of measuring points that are blank, you can either add a row for each into a collection, or append them into a single string with a delimiter after each entry.  It all depends on why you are keeping these and what you plan to do with the list.  If you are going to use this list on the client for something, I would suggest adding object rows to a temporary collection for easy access later.  If you just want to pass this list to the backend for some processing, then a single delimited string would be better.  Which way do you think would work best for you?  Let us know and myself or Bill could explain how to handle it.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

Thanks for the input. Our requirement would be more inclined towards populating the list in a comma delimited string and then send it across to the back-end which is basically going to be consumed by a different application. It would be great if you could explain me how to do that.

Thanks

Arpan

jason_latko
Active Contributor
0 Kudos

Arpan,

Create a an action called LoopOverPoints that has a sub-action step.  This step should "Loop over Collection".  Point to your collection of points.  Add an execute rule to this step.  The execute rule will run once for each row in the collection.  If the rule returns true for a row, then it will be processed by running the sub-action's action.  The rule should look something like this:

EQSTR

     MeasureingPoint Object -> Reading property

     EMPTY (blank constant or some other way that an empty reading is measured)

There may also be a boolean to indicate a reading has been taken?  In that case the rule could be:

NOT

     isReadingTaken (Boolean property)

Create a main object string property called TempPoints.  Create an edit transaction against the main object that contains the TempPoints string.  Initial Value is "Rule before data entry".  Create a rule called InitialValueAppendPoint.  This rule looks something like this:

CONCATENATE

     TempPoints Property

     "|" (This is a constant with a pipe delimiter)

     MeasureingPoint Object -> Whatever property

The above rule will start with the existing contents of the string and append a pipe (|), then will add whatever property you want from the current measuringpoint object we are looping over.

Tie this transaction to an action called ProcessBlankPoint.  This action should be tied to your looping step in LoopOverPoints action.  Don't forget to add an Apply step as the last step for ProcessBlankPoint.  This is necessary to save the data to the temp variable for each point.

The sub-action loop will continue to do this until the collection has been processed.  You will be left with a delimited string of all the blank measuringpoints that you can send to the backend with an update step placed on the transaction.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

I just had a quick glance at your suggestion above and to me it seems like it should work. However, I will confirm you back in sometime once I try out the solution provided by you.

Thanks

Arpan

Answers (0)