Update objects in a list with looping query

0
I am trying to update records (objects) in a list with new values returned without changing the non-null values existing in the record already. I am looping through a list of tables and fields, and querying my database based on the new information. Each table is getting its specific fields, and returning the correct data. But, when I update the list of overall returned data, I cannot match up the new values with their already existing counterparts. For example, I query on Name from Table 1, and get a list of objects having the Name attribute populated. Then, on loop 2, I query another table and return values for Date of Birth. Those have a Name counterpart in reality, but if i use those values to update the list, I will either wipe out my existing Names or add new records with a blank Name but an existing DOB.  State 1:                                                State 2:                                                                                      What I want: Name | DOB |                   Either:    Name | DOB   |        OR:       Name | DOB   |                                Name | DOB   |    Fred   |           |                                   Fred   |             |                                 | 2/6/78 |                               Fred   | 2/6/78|                                                                          | 2/6/79|          I tried to use the Change Object action to change each existing object in the list after each query has completed, but you need to select the fields statically, i can't pass in the list of fields that I just completed a query on into the action. If i select all the fields, it will update with null values where nothing was pulled, and I'll be back where I started.  What can I do to add my data to the existing object in the list to ensure the data lines up side-by-side after each iteration of the query in the loop? 
asked
1 answers
1

Stephen,

In your Change Object action, you can use conditionals for the value you set each attribute to.  So lets say you have Object1 with Name, Object2 with DOB and Object3 with Name and DOB.  If you are looping through a  list of Object3 and want to update based on retrieved Object1 and Object2 values, in your Change Object action, you could set the value of attribute DOB as follows:

if $Object2 != empty and $Object2/DOB != empty
then
  $Object2/DOB
else
  $IteratorObject3/DOB

This way, if you successfully retrieve Object2 and it has a DOB that is not empty, you'll set Object3/DOB to that value, otherwise you'll keep the existing value of Object3/DOB.

Does that help?

Mike

answered