Two payloads to pass in parameters of the HTTP request URL resolving in undefined

Hello !

I want to provide start date and end date in the parameters of a POST http request URL.
My flow looks like below -

I am fetching end date as tomorrow using below code.

var tomorrow = new Date();
tomorrow.setUTCDate(tomorrow.getUTCDate() + 1);
msg.payload = tomorrow;
return msg;

I am using date/time formatter nodes to convert the start date and end date in YYYY-MM-DD format it works perfectly when I check with Debug node.

But when I try to put the start date and end date in parameters body, the debug result always gives two seperate parameter bodies and each time either start date or end date is undefined.

let n = 0;

while (n < 2) {
  n++;
if (msg.topic == 'CurrentDate')
{
var payload1 = msg.payload;
}
else if(msg.topic == 'NextDate')
{
var payload2 = msg.payload;
}
}

msg.payload = {
  "Parameters": [
    "PM10",
  ],
  "Sites": [
    1001
  ],
  "StartDate": payload1,
  "EndDate": payload2,
  "Categories": [
    "Averages"
  ],
  "SubCategories": [
    "Hourly"
  ],
  "Frequency": [
    "Hourly average"
  ]

}

Please find below debug result screenshots -
Screen Shot 2022-11-30 at 2.41.20 pm

Please see below how I want parameters to look like and pass as msg.payload to HTTP request node (check start and end date)-

{
  "Parameters": [
    "PM10",
  ],
  "Sites": [
    1001
  ],
  "StartDate": "2022-11-30",
  "EndDate": "2022-12-01",
  "Categories": [
    "Averages"
  ],
  "SubCategories": [
    "Hourly"
  ],
  "Frequency": [
    "Hourly average"
  ]

}

Previously I did not use the 'While' statement and the debug result was " String reference not set to an instance of a string. Parameter name: s " .

Could you all Node-Red and javascript champions help me resolve this?

Kind regards,
Amit

You would need to join the payloads so they are in the same message.

Alternatively you can set each date formatter in series and move the payload to alternative message properties using a change node after each formatter.
I would just generate todays and tommorrows dates in a change node and then create url in a template node.
e.g.

[{"id":"622d1f7a11bb6b50","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":3760,"wires":[["5758fe0dde48aac7"]]},{"id":"5758fe0dde48aac7","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"today","pt":"msg","to":"$moment().tz(\"Europe/london\").format(\"YYYY-MM-DD\")","tot":"jsonata"},{"t":"set","p":"tomorrow","pt":"msg","to":"$moment().tz(\"Europe/london\").add(1, \"day\").format(\"YYYY-MM-DD\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":3760,"wires":[["d26fa1f9bd7ab6a5"]]},{"id":"d26fa1f9bd7ab6a5","type":"template","z":"452103ea51141731","name":"","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"https://example.com?start={{today}}&finish={{tomorrow}}","output":"str","x":460,"y":3760,"wires":[["4c1315e02a0e08cd"]]},{"id":"4c1315e02a0e08cd","type":"debug","z":"452103ea51141731","name":"debug 110","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":3760,"wires":[]}]
1 Like

Hi E1cid,

The solution you provided worked, I used the change node and msg.today and msg.tomorrow in the function that I created and it successfully provided me with the parameters body the way I required.

msg.payload = {
  "Parameters": [
    "PM10",
  ],
  "Sites": [
    1001
  ],
  "StartDate": msg.today,
  "EndDate": msg.tomorrow,
  "Categories": [
    "Averages"
  ],
  "SubCategories": [
    "Hourly"
  ],
  "Frequency": [
    "Hourly average"
  ]

}

return msg;

Debug output :
Screen Shot 2022-12-01 at 9.51.58 am

Thank you !

Kind regards,
Amit

Hi Again,

I am also trying to fetch Air Quality data of PM10 and CO from the JSON file I receive from the API call.
The file looks like below -

[{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":1,"HourDescription":"12 am - 1 am","Value":-0.11487,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":1,"HourDescription":"12 am - 1 am","Value":16.101,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":2,"HourDescription":"1 am - 2 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":2,"HourDescription":"1 am - 2 am","Value":10.175,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":3,"HourDescription":"2 am - 3 am","Value":-0.15443,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":3,"HourDescription":"2 am - 3 am","Value":13.202,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":4,"HourDescription":"3 am - 4 am","Value":-0.130146,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":4,"HourDescription":"3 am - 4 am","Value":13.289,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":5,"HourDescription":"4 am - 5 am","Value":-0.125505,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":5,"HourDescription":"4 am - 5 am","Value":11.953,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":6,"HourDescription":"5 am - 6 am","Value":-0.109888,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":6,"HourDescription":"5 am - 6 am","Value":11.8,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":7,"HourDescription":"6 am - 7 am","Value":-0.105976,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":7,"HourDescription":"6 am - 7 am","Value":11.441,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":8,"HourDescription":"7 am - 8 am","Value":-0.109031,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":8,"HourDescription":"7 am - 8 am","Value":14.554,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":9,"HourDescription":"8 am - 9 am","Value":-0.093543,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":9,"HourDescription":"8 am - 9 am","Value":14.643,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":10,"HourDescription":"9 am - 10 am","Value":-0.1052,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":10,"HourDescription":"9 am - 10 am","Value":13.027,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":11,"HourDescription":"10 am - 11 am","Value":-0.115724,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":11,"HourDescription":"10 am - 11 am","Value":13.855,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":12,"HourDescription":"11 am - 12 pm","Value":-0.108498,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":12,"HourDescription":"11 am - 12 pm","Value":11.367,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":13,"HourDescription":"12 pm - 1 pm","Value":-0.097682,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":13,"HourDescription":"12 pm - 1 pm","Value":11.767,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":14,"HourDescription":"1 pm - 2 pm","Value":-0.094643,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":14,"HourDescription":"1 pm - 2 pm","Value":12.608,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":15,"HourDescription":"2 pm - 3 pm","Value":-0.095467,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":15,"HourDescription":"2 pm - 3 pm","Value":12.206,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":16,"HourDescription":"3 pm - 4 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":16,"HourDescription":"3 pm - 4 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":17,"HourDescription":"4 pm - 5 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":17,"HourDescription":"4 pm - 5 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":18,"HourDescription":"5 pm - 6 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":18,"HourDescription":"5 pm - 6 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":19,"HourDescription":"6 pm - 7 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":19,"HourDescription":"6 pm - 7 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":20,"HourDescription":"7 pm - 8 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":20,"HourDescription":"7 pm - 8 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":21,"HourDescription":"8 pm - 9 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":21,"HourDescription":"8 pm - 9 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":22,"HourDescription":"9 pm - 10 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":22,"HourDescription":"9 pm - 10 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":23,"HourDescription":"10 pm - 11 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":23,"HourDescription":"10 pm - 11 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":24,"HourDescription":"11 pm - 12 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":24,"HourDescription":"11 pm - 12 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null}]

Flow looks like below -

Debug result looks like below -

The data gives information of 'PM10' or 'CO' in separate slots of Hourdescription: "12 AM - 1 AM" till 24 hours complete. If the the time of the day is 12 PM, I will receive vqalue of 'PM10' for slot 12PM to 1PM but 1PM to 2PM slot will have a Null value.

Just like 'PM10' and 'CO' I can add more parameters like 'NO', 'OZONE', 'SO2' etc. and each of these parameters will increase the JSON file size provide values for 24 slots of time throughout the day.

I want to check the current time (say it's 12PM right now) and pull out the value of all parameters I have asked for between the slot 12PM to 1PM. And I will trigger the flow each hour to get the values for the entire day. How do I achieve this, it's tricky and I am learning javascript and node-red.

Please let me know if you need any more information.

Kind regards,
Amit

This is really a new question, I would ask that you start a new topic, with a descriptive title so others may looking for answers may find the answer more easily. (e.g how to filter array for required parameters by hour)

p.s. The http request node can be configured to output a parse json object, so no need for the json node.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.