Skip to main content
June 26, 2024
Question

Need data to be represented in given format below

  • June 26, 2024
  • 3 replies
  • 0 views

In-order to display data over a World map which is an add-on/ plug-in

system is accepting the data in :

local!test:a!map(

1:{

latitude: "18.1096",

longitude: "-77.2975",

tooltip: { content: "Jamaica" }

},

2:{

latitude: "35.9078",

longitude: "127.7669",

tooltip: { content: "Korea (South)" }

}

),

But while using forEach loop we are getting data from system in below expression and format

a!forEach(
items: local!getMatchedIntells,
expression: a!localVariables(
local!id: fv!index,
local!name: "",
local!lat: "",
local!long: "",
local!finalDt: a!map(
latitude: local!lat,
longitude: local!long,
tooltip: { content: local!name }
),

local!finalDt

)

[{'1': {latitude: 23.424076, longitude: 53.847818, tooltip: {content: "United Arab Emirates"}}}, {'2': {latitude: 33.93911, longitude: 67.709953, tooltip: {content: "Afghanistan"}}}, {'3': {latitude: 41.153332, longitude: 20.168331, tooltip: {content: "Albania"}}}]

can we make the resulting one as the expected one

even i had tried with merge and update options aswell

    3 replies

    sriramk5349
    June 26, 2024

    Hi [mention:24e8f732fdd343a3b68413e0a65b3e02:e9ed411860ed4f2ba0265705b8793d05] ,

    the expected one is resembling JSON. I think you need to give data in JSON format, you can use a!tojson() function.

    June 26, 2024

    Here the expected format is of Dictionary Type

    June 26, 2024

    The following might help:

    {
      createdictionary(
        { "Jamaica" },
        {
          createdictionary(
            { "latitude", "longitude", "tooltip" },
            {
              18.1096,
              - 77.2975,
              createdictionary("content", "Jamaica")
            }
          )
        }
      ),
      createdictionary(
        { "Korea" },
        {
          createdictionary(
            { "latitude", "longitude", "tooltip" },
            {
              35.9078,
              127.7669,
              createdictionary("content", "Korea")
            }
          )
        }
      )
    }