tostore data from http resppponse to table

Certified Associate Developer

In http response I am getting IDs and codes. Each id will have multiple codes. now i need to store the code with respective Id in table. How to do it?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Are the Ids and codes coming as arrays/lists in the JSON response (like id: 123, codes: ["A", "B", "C"]), or are they coming as separate flat rows?
    If you assume like this,

    a!localVariables(
      local!httpResponse: {
        { id: 101, codes: { "A1", "A2", "A3" } },
        { id: 102, codes: { "B1", "B2" } },
        { id: 103, codes: { "C1", "C2", "C3", "C4" } }
      },
      local!flattenedData: a!flatten(
        a!forEach(
          items: local!httpResponse,
          expression: a!localVariables(
            local!currentId: fv!item.id,
            a!forEach(
              items: fv!item.codes,
              expression: { id: local!currentId, code: fv!item }
            )
          )
        )
      ),
      local!flattenedData
    )



Reply
  • 0
    Certified Lead Developer

    Are the Ids and codes coming as arrays/lists in the JSON response (like id: 123, codes: ["A", "B", "C"]), or are they coming as separate flat rows?
    If you assume like this,

    a!localVariables(
      local!httpResponse: {
        { id: 101, codes: { "A1", "A2", "A3" } },
        { id: 102, codes: { "B1", "B2" } },
        { id: 103, codes: { "C1", "C2", "C3", "C4" } }
      },
      local!flattenedData: a!flatten(
        a!forEach(
          items: local!httpResponse,
          expression: a!localVariables(
            local!currentId: fv!item.id,
            a!forEach(
              items: fv!item.codes,
              expression: { id: local!currentId, code: fv!item }
            )
          )
        )
      ),
      local!flattenedData
    )



Children
No Data