HI , noob to javascript and node-red , but loving it. managed to get a complex bit of code running but now im stuck on possibly a really simple issue.
so i have an xml file that i need to pull some data off ( badly formated! but its wha ti have to work with!).
im trying to some waypoints, i know the number of waypoints in total from a function
var wayPointCount = {payload: msg.payload.Configuration.MissionManager[0].WptTrack_0[0].NoWayPts[0]};
this returns a number as a string, which i think is ok , ill sort that bit i can always add a count value to test
anyway i need to grab the section i need from the xml
var wayPoints = {payload:msg.payload.Configuration.MissionManager[0].WptTrack_0[0].WayPt_0[0].LatLong};
so i need too change the WayPt_0 to WayPt_X for example and loop though and change X.
like i said its probably really simple and the answer is staring me in the face, but i seem to have gone code blind!
Im thinking someway along these lines
var wayPointCount = {payload: msg.payload.Configuration.MissionManager[0].WptTrack_0[0].NoWayPts[0]};
for (; i < wayPointCount; ) {
var wayPoints = {payload: msg.payload.Configuration.MissionManager[0].WptTrack_[i][0].NoWayPts[0]};
i++;
return wayPoints;
}
any help would be gratfully recieved
thanks