Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Array within an Array API read

Hi I had the following JSON and was able to get the script for it but now I am working on another table which has an array within an array and was wondering how I could make that call?

For the JSON I was able to get with a single array:

"UserUid": "######",
"LastUpdate": "#######",
"Form": [
{
"$type": "#############i",
"Address1": "#########",
"Address2": "",
"Address3": ""
}

which I can use the following to get

<attr Name="UserUid" xs:type="string" other:xPath="{RepeatElement}UserUid" >
<attr Name="LastUpdate" xs:type="datetime" other:xPath="RepeatElement}LastUpdate">
<attr Name="Form" xs:type="string" other:xPath="RepeatElement}Form" />

<attr name="_type" xs:type="string" readonly="false" other:xPath="/Form$type" />
<attr name="Address1" xs:type="string" readonly="false" other:xPath="/Form/Address1" />
<attr name="Address2" xs:type="string" readonly="false" other:xPath="/Form/Address2" />
<attr name="Address3" xs:type="unknown" readonly="false" other:xPath="/Form/Address3" />



Now how would it look for the following

"UserUid": "######",
"LastUpdate": "#######",
"Form": [
{
"Name": "######",
"FormQuestions": [
{
"FormQuestionid": "###########",
"_Type": "########",
"Address1": "###########"
}
}

3 Community Answers

Paul D'Angelo —

Correct me if I am wrong but I may have my answer:

"Only one Repeat Element and one Sub Repeat Element is allowed per RSD file"

https://redshiftsupport.matillion.com/customer/en/portal/articles/2836045-creating-api-profiles-support


Paul D'Angelo —

I found a solution. You need to create separate RSD files per array level and then in your job you can join those on a concatenation of the highest level fields (or single unique field) which you can bring in on each RSD file.

So in my above problem, I can bring in UserUid and LastUpdate on a file with Name and FormQuestions and also on another RSD file with FormQuestionId, _Type, and Address1

Just need to change the Sub Repeat Element in each file to get the desired array level


Matillion Agent  

Jason Kane —

Yep looks like you’ve got it.

Thanks,
Jason

Post Your Community Answer

To add an answer please login