Skip to main content
  • 10000+ Posts
  • 53,237 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

I am trying to expose IFC attributes based on the ifc_property_set collection of names. The end result should be a feature with only the ifc_property_set attributes exposed on the feature.

As the IFC property sets are configured in other systems i do not have prior knowledge of the attributes to expose these for the writers. I need to be able to feature attribute cleanup so that i can expose these attribute collections without prior knowledge of the feature information.I have successfully exposed the attributes from the collections as a feature attribute but these are still hidden from the writer. I am able to interrogate each feature and build a picture of those attributes in Python but cannot seem to expose these programmatically.  def processFeature(feature):    print("**Processing feature**")    print(feature.getAttribute('ifc_property_set'))    #ifcpropertieslist = feature.getAttribute('ifc_properties')    print(feature.getAllAttributeNames())    i=0    attrNames=feature.getAllAttributeNames()    elementCount = int(feature.getAttribute("_element_count"))    print(elementCount)    e

Badge Winners

  • FME Certified Professional
    jc4fmehas earned the badge FME Certified Professional
  • Integrate Spatial Data
    rosemartinhas earned the badge Integrate Spatial Data
  • Online Training
    rosemartinhas earned the badge Online Training
  • FME Certified Professional
    cforsdickhas earned the badge FME Certified Professional
  • Online Training
    learningfmehas earned the badge Online Training
Show all badges

Community Stats

32,416
Posts
122,935
Replies
40,137
Members

Latest FME