Cannot Correlate Inconsistent Array Return

We have a data action that returns multiple instances of arrays nested in the return. While flattening is not an issue, correlation of said data IS an issue. For example -

{
  "recordCount": 3,
  "records": [
    {
      "Name": "Wayne Franis",
      "producers": [
        {
          "name": "Cheese Factories Of America",
          "last5": "12345",
          "last4": "1111"
        }
      ]
    },
    {
      "Name": "Phil Jones",
      "producers": []
    },
	{
      "Name": "Kerry Whilm",
      "producers": [
	    {
          "name": "Billy Beer",
          "last5": "12345",
          "last4": "1111"
        }
	  
	  ]
    }
	
  ]
}

The issue we're seeing is that the name array has 3 entries, while the producers array has 2. As such, we can't correlate the data without the producers array containing SOME value (probably a null, or a string like "No Producer"). I've tried most everything to get the translation map or translation map default to set a not-set value as a null. Any help would be appreciated!

Hey Jason,

Are you trying to correlate the data in Architect? Or what exactly are you trying to do with it?

Is there a limit to the number of items that you might need to correlate?

--Jason

I need to correlate which producer comes from which record. if a caller enters a last 4 ssn value from a producer as an authentication, we are required to populate the name from the record and the producer from that record.

Hey Jason,

So assuming you can't convince the owner of the API that you are hitting to let you filter on last4 or last5, the next best approach would be to use an input parameter to do your translation map work, which unfortunately isn't currently allowed :frowning: Using a foreach in the velocity would also probably make it possible to solve this issue, which is also not currently allowed.

Another thread is running into the same problems right now:

I opened up a ticket for my team to reconsider those limitation of data actions. In the meantime doing all of your work in a lambda seems like the easiest available approach to this problem.

--Jason

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.