Nested JSON via Integration object on to a Paging grid error

Hello, 

I am new to Appian. i am trying to display data on to a paging grid. it seems i ran in to an issue with the JSON structure here(I am not sure). 

I am unable to retrieve data values on to the grid.

Steps to recreate the issue:

1. create an integration which returns the JSON Data.

2. Automatic Output parsing is Checked with "convert the JSON Response body to an appian Value" 

3. using the rule input ( rule! ). assign the data to a local variable in the Expression Editor.below is the interface definition.

 Interface Definition:

load(
/* local Variables */
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: -1,
    sort: a!sortInfo(
      field: "_id",
      ascending: true
    )
  ),
  local!integrationData: rule!Test_integration(
    alternateId: "123"
  ).result.body,
  
  with( 
    a!gridField(
      rowHeader: 1,
      totalCount: 1,
      columns: { 
        a!gridTextColumn( 
          label: "Name",
          field: "_name",
          data: index(local!integrationData, "1", {})
        ),
        a!gridTextColumn(
          label: "Type",
          field: "_type",
          data: index(local!integrationData, "3", {})
        ),
        a!gridTextColumn(
          label: "ID",
          field: "_id",
          data: index(local!integrationData, "5", {})
        ),
        a!gridTextColumn(
          label: "Address",
          field: "_address",
          data: a!forEach(
            items: local!integrationData._address,
            expression: fv!item
          )
        )
      },
      value: local!pagingInfo,
      saveInto: local!pagingInfo
    )
  )
  
)

JSON Obj:

{  
  "paging":{  
    "numTotal":1,
    "pageSize":999,
    "end":0,
    "begin":0
  },
  "items":[  
    {  
      "_name":"value1",
      "_address":[  
        {  
          "_name":"value2",
          "_type":"Home",
          "_id":"7p8u9l",
          
        },
        {  
          "_name":"value3",
          "_type":"work",
          "_id":"0y7r6q"
          
        },
        {  
          "_name":"value4",
          "_type":"business",
          "_id":"4t5w6e"
          
        }
      ],
      "_type":"developer",
      "name":"value1",
      "_id":"1fe34t"
    }
  ]
}

  Discussion posts and replies are publicly visible

Parents
  • You have missed the .data usage in the code. The below code gives you entire dictionary and you will have to retrieve data part of it.

    local!integrationData: rule!Test_integration(
    alternateId: "123"
    ).result.body

    Also you will have to index further to display correct values (from your json) in columns. See below to get a clear picture.

    Example:

    a!gridTextColumn(
    label: "Name",
    field: "_name",
    data: index(
    index(
    local!integrationData.data,
    "items",
    {}
    ),
    "_name",
    {}
    )
    )

    Thanks!

Reply
  • You have missed the .data usage in the code. The below code gives you entire dictionary and you will have to retrieve data part of it.

    local!integrationData: rule!Test_integration(
    alternateId: "123"
    ).result.body

    Also you will have to index further to display correct values (from your json) in columns. See below to get a clear picture.

    Example:

    a!gridTextColumn(
    label: "Name",
    field: "_name",
    data: index(
    index(
    local!integrationData.data,
    "items",
    {}
    ),
    "_name",
    {}
    )
    )

    Thanks!

Children
No Data