Appian RPA update multiple get attributes in RPA Loop

hi,

I am trying to create a BOT that will read records from Appian DB, hit a website, extract information (get attributes) and update few other columns of the DB.

The table is

The BOT reads restaurantname (in a loop), get attributes (status and date) and update the DB back

this is what I have

Loop is: foreach pv!restaurant.restaurantName

Update value in search is "interact with element" with value as fv!item

Get Date is 'get attribute' with target as restaurant.inspectionDate where restaurant is a variable of type CDT that has

when i run this BOT (through a process model) I see the restaurant names are picked up fine by the loop (one after another),

however the status and date values that gets updated is for the last entry in the table (in this case: Gallery Market & Cafe) 

so when I see the process variable in BOT after it has run it is 

Value
[{"restaurantID":1,"restaurantName":"True Food Kitchen","restaurantStatus":"Status: Permitted","inspectionDate":"June 29, 2022"},
{"restaurantID":2,"restaurantName":"Gallery Market & Cafe","restaurantStatus":"Status: Permitted","inspectionDate":"June 29, 2022"}]
but actually it should be 
Value
[{"restaurantID":1,"restaurantName":"True Food Kitchen","restaurantStatus":"Status: Permitted","inspectionDate":"Aug 31, 2022"},
{"restaurantID":2,"restaurantName":"Gallery Market & Cafe","restaurantStatus":"Status: Permitted","inspectionDate":"June 29, 2022"}]
How do I make my BOT retain the attribute value (Aug 31, 2022) of the first record and not get overridden by the attribute value of the last record ??
any help will be appreciated
my process model works fine.. the problem I see is in the BOT itself. Once the Value is updated correctly the process model will do its job. Let me know if you need more information 
my current output is 
but it should be
thanks
jaideep

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    I have the same problem as well, I'm trying to update the status field of the current item in the loop after processing it, but it doesn't get saved in the variable. I can't use the target since it doesn't have an option to select an index or create an expression to point to the current index of the loop. I want to save the status first in the cdt variable so I can run the process model to update database just once after the loop, but I can't seem to find a workaround. Have you solved this problem?

  • 0
    Certified Associate Developer
    in reply to Anwille

    Hi Anwille, try changing the index to be fv!index in your a!update. What data type is fv!item? If it is a CDT, you may need to cast the values per Jaideep's answer above.

  • 0
    Certified Associate Developer
    in reply to Cyrus Saadat

    Hello, The fv!item is a multiple CDT. I’m trying to update the “requestStatus” field of the current item after each iteration of the loop. I tried casting values as well and used the item variable as the target save but it overrides the existing items. The workaround I did is using append instead of store and removing the 1st index of the CDT variable after appending. If there’s other optimal way of fixing this, I would appreciate.

Reply
  • 0
    Certified Associate Developer
    in reply to Cyrus Saadat

    Hello, The fv!item is a multiple CDT. I’m trying to update the “requestStatus” field of the current item after each iteration of the loop. I tried casting values as well and used the item variable as the target save but it overrides the existing items. The workaround I did is using append instead of store and removing the 1st index of the CDT variable after appending. If there’s other optimal way of fixing this, I would appreciate.

Children
No Data