0

Good morning,

I'm hoping someone can assist me with a JSON file. I have a Powerapps canvas app which collates many tables of data in to a final collection on the last screen. This should then be converted to a JSON file to be used by Power Automate to send it to the service endpoint for our sql database.

The issue, is that anywhere in the collection where there is a nested table, such as 'areas', 'auditors' etc the JSON ends up with the column name 'Value' inserted. I need to remove this so that these tables are displayed as simple arrays...

i.e. "areas":[{1},{2}} rather than "areas":[{"Value":1},{"Value":1}]

Any help would be greatly appreciated.

Amanda

My collect statement is below...it takes values from several other collections throughout the app.

This is my collect statement before it's sent to the flow.                       
Collect(
SubmitAuditRequest,
{
    results: [
        {
            questionKey: Value(lblQKey.Text),
            answer: txtQSCM.Text,
            addToActionPlan: false,
            additionalComments: txtQComments.Text,
            typeCode: 1,
            score: txtQGrade.Text,
            actions: [
                {
                    parentKey: 1,
                    parentTypeCode: "RECORD_PARENT_TYPE_##3",
                    action: txtQActions.Text,
                    dateRequired: txtQActionDue.Text,
                    assignedToKey: LblQUserKey.Text,
                    statusCode: "ACTION_STATUS_TYPE_##1",
                    priorityCode: "PRIORITY_TYPE_##3"
                }
            ],
            attachments: [
                {
                    parentKey: 1,
                    parentTypeCode: "RECORD_PARENT_TYPE_##2",
                    documentBase64: "",
                    name: "New Image",
                    extension: "img",
                    attachmentTypeCode: "RECORD_DOCUMENT_TYPE_##1"
                }
            ]
        }
    ],
    organisationKey: 1,
    name: "TestAudit",
    typeCode: "AUDIT_TYPE_##1",
    statusCode: "AUDIT_STATUS_TYPE_##1",
    auditors: [
        1,
        2
    ],
    auditDate: Text(
        Today(),
        "yyyy-mm-dd"
    ),
    staffLeadList: [
        1,
        2
    ],
    areas: [
        1,
        2
    ],
    attachments: [
        {
            parentKey: 2,
            parentTypeCode: "RECORD_PARENT_TYPE_##2",
            documentBase64: "",
            name: "Image 01",
            extension: "img",
            attachmentTypeCode: "RECORD_DOCUMENT_TYPE_##1"
        },
        {
            parentKey:2,
            parentTypeCode: "RECORD_PARENT_TYPE_##2",
             documentBase64: "",
            name: "AudioClip",
            extension: ".3gp",
            attachmentTypeCode: "RECORD_DOCUMENT_TYPE_##2"
        }
    ],
    staffList: [
        3,
        4
    ],
    focusArea: [
        "Focus"
    ],
    focusSubArea: [
        "Focus Area",
        "Focus Area 2"
    ],
    successCriteria: [
        "Success Criteria 1",
        "Success Criteria 2"
    ],
    comment: "No comment",
    Key: 0,
    userKey: 1,
    IsActive: true
}

); SubmitAudit.Run( JSON(SubmitAuditRequest), userSettings.token );

SumbitAuditRequestJSON SubmitAuditRequest Collection

ITBirdCEH
  • 19
  • 1
  • 7
  • How are you creating the collections upstream? Please add your `Collect` / `ClearCollect` statements. The answer is based on that. – SeaDude Jul 15 '21 at 03:08
  • @SeaDude I've added my collect statement to my original post. Does this help? – ITBirdCEH Jul 15 '21 at 07:42
  • 1
    When you say "...so that these tables are displayed as simple arrays...", are you trying to display the collection in your app? Like in a gallery control? – SeaDude Jul 18 '21 at 03:41

0 Answers0