Skip to main content
  • 10000+ Posts
  • 53,427 Replies
10000+ Posts
JSONTemplater and XQuery with nested for and if statements

I managed to generate a new json from the original one getting the info I need but now I see there's some missing data.Each project group has an id, lat-lon info and an array with data for every project inside the group.I generate a new json with a feature for every project but need to also add a feature for every project group without projects in it.This is what I have:[    let $doc := fme:get-json-attribute("_response_body")    for $i in (1 to jn:size($doc))        let $id := $doc($i)("id")        let $lat := $doc($i)("lat")        let $lon := $doc($i)("lng")        let $proj := $doc($i)("projects")        for $j in (1 to jn:size($proj))            return              {|                {"id" : $id},                {"lat" : $lat},                {"lon" : $lon},                {"proj_name" : $proj($j)("name")}            |}]I've tried to nest

Badge Winners

  • Online Training
    richrbbchas earned the badge Online Training
  • Webinar Watcher (Bronze)
    a.meshkathas earned the badge Webinar Watcher (Bronze)
  • FME Certified Professional
    souryanahas earned the badge FME Certified Professional
  • FME Form Basic Training
    nielswhas earned the badge FME Form Basic Training
  • FME Form Advanced Training
    markbhhas earned the badge FME Form Advanced Training
Show all badges

Community Stats

32,504
Posts
123,456
Replies
40,703
Members