• Resolved yichu

    (@yichu)


    The following is what I got from api call. I would like to show data in weatherElement array which is combined as elementName&elementValue.

    I set basenode as location and template as
    {subloop-array:weatherElement:-1}{elementName}{elementValue} {/subloop:weatherElement}

    but with no luck.
    Could you please give me some suggestion? Thanks!

    {
    “success”: “true”,
    “result”: {
    “resource_id”: “O-A0001-001”,
    “fields”: [
    {
    “id”: “lat”,
    “type”: “Double”
    },
    {
    “id”: “lon”,
    “type”: “Double”
    },
    {
    “id”: “locationName”,
    “type”: “String”
    },
    {
    “id”: “stationId”,
    “type”: “String”
    },
    {
    “id”: “obsTime”,
    “type”: “Timestamp”
    },
    {
    “id”: “elementName”,
    “type”: “String”
    },
    {
    “id”: “elementValue”,
    “type”: “String”
    },
    {
    “id”: “parameterName”,
    “type”: “String”
    },
    {
    “id”: “parameterValue”,
    “type”: “String”
    }
    ]
    },
    “records”: {
    “location”: [
    {
    “lat”: “24.144778”,
    “lon”: “121.264083”,
    “locationName”: “合歡山”,
    “stationId”: “C0H9C0”,
    “time”: {
    “obsTime”: “2021-06-16 16:00:00”
    },
    “weatherElement”: [
    {
    “elementName”: “TEMP”,
    “elementValue”: “11.7”
    },
    {
    “elementName”: “HUMD”,
    “elementValue”: “1”
    },
    {
    “elementName”: “PRES”,
    “elementValue”: “678.3”
    }
    ],
    “parameter”: [
    {
    “parameterName”: “CITY”,
    “parameterValue”: “南投縣”
    },
    {
    “parameterName”: “CITY_SN”,
    “parameterValue”: “13”
    },
    {
    “parameterName”: “TOWN”,
    “parameterValue”: “仁愛鄉”
    },
    {
    “parameterName”: “TOWN_SN”,
    “parameterValue”: “122”
    }
    ]
    }
    ]
    }
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter yichu

    (@yichu)

    Hi!

    I’m getting close to it! Thank you for making this plugin. Now I can start to do some experiment!

    {subloop-array:location:-1}{subloop-array:location.weatherElement:-1}weatherElement.elementValue: {location.weatherElement.elementValue}
    {/subloop-array:location.weatherElement}

    Thread Starter yichu

    (@yichu)

    I would like to know if there’s a way to specific point to an element inside an array using surloop? For example, I would like to printout as following

    temperature:11.7
    humidity:1
    pressure:678.3

    instead of the elementValue.

    TEMP:11.7
    HUMD:1
    PRES:678.3

    “weatherElement”: [
    {
    “elementName”: “TEMP”,
    “elementValue”: “11.7”
    },
    {
    “elementName”: “HUMD”,
    “elementValue”: “1”
    },
    {
    “elementName”: “PRES”,
    “elementValue”: “678.3”
    }
    ],
    Plugin Author berkux

    (@berkux)

    Hi yichu,

    unfortunately you can’t do that with the free plugin.

    Bernhard

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Having problem retrieve the data’ is closed to new replies.