Select to view content in your preferred language

Map Filters in Survey123 Reports

876
1
11-27-2024 03:30 PM
CarissaPhantom
Emerging Contributor

Hello!

I have been trying to use the new Survey123 Report functionality of Map Filters.  It was discussed here.

It introduces a new method of calling report maps, using the $map function.  You can then filter layers dynamically based on the fields of the input layers.

However, I would like to use this differently, and found some success but am getting stuck on one step.  Scenario One I was able to get it to work, Scenario Two I was not and would love help with.  In both scenarios, I am still using a geopoint question to call up the report map, because I still want the map to center on the input record I am printing a report for.  So already the use case is a bit unorthodox, but I would love to figure out Scenario 2.

Scenario 1:  I have a survey layer and some separate supporting reference layers on a webmap.  The data in the Survey123 form is all organized by project number (e.g. 456, 675 etc).  Some supporting reference data also has this project number in it.  I was able to get the map to filter this supporting ref. data based on project number with the following syntax: 

${GeoPoint Question in Survey  | map:"ITEMID" | mapFilters:"'18fe96a428a-layer-22':where=Numb='"+ProjectNumber+"'" | mapScale: 4000| size: 720:800}.

What happening above is: 1. I call up the reports geopoint question as center of map, I specify web map where survey layer is on, I then filter the supporting reference layer by the its field "Numb", and its dynamically filtered based on the input value for the field "ProjectNumber" from my survey layer.  This works!

But...

Scenario 2:  I have a survey layer with 3 repeats.  I want to filter the report maps to only show those repeat records that are tied to my parent survey form.  Some surveys take place in the same area, so when I make maps for parent survey records in the same area, old data from previous surveys ends up on the map and I dont want that.  I thought the following would work: 

${GeoPtQuestion | map:"ITEMID" | mapFilters:"'18ebfb5dec5-layer-11':where=ParentGlobalID='"+GlobalID+"'" | mapScale: 1000| size: 615:615}

I hoped the above statement would filter the child related record "'18ebfb5dec5-layer-11' by ParentGlobalID based on the input GlobalID of the selected parent record to print on the report.  Similar to scenario one, but, in this case I am attempting to filter a related child record based on the parent record GlobalID. I get the following error

Error: An error occurred when checking the report template. Failed to parse ${lat_longs | map:"efc18d7e0d5b41dc86185daada35a5e5" | mapFilters:"'18ebfb5dec5-layer-11':where=ParentGlobalID='"+GlobalID+"'" | mapScale: 1000| size: 615:615} since GlobalID cannot be found in the current parsing scope.

It may be that this is not possible.  But I was hoping someone out there knew, perhaps @ZhifangWang you could shed some light on this?  Or anyone else?  This would be incredibly helpful and make maps much more customizable.

**Note** I was pretty exact with my syntax I think, I edited it a few times.  I also at first tried to filter all 3 child records, but then reduced it just to one for testing.   Thanks in advance all!

0 Kudos
1 Reply
AlfredBaldenweck
MVP Regular Contributor

Sorry this is so late, but this post just solved a related problem of mine so I figured I'd return the favor.

The way to do scenario 2 is to make your own field holding the keys.

TypeNameCalculationParameterType
calculationoriguuidonce(uuid())esriFieldTypeGUID
begin repeatrepeat1  
calculationdestuuid${origuuid}esriFieldTypeGUID
begin repeatnestedrepeat  
calculationnestuuid${origuuid}esriFieldTypeGUID
end repeatnestedrepeat  
end repeatrepeat1  

 

This way you can link the nested repeat back to the original survey record. It's be nice if this was done for you, but it isn't.

Make sure to wrap the uuid() in a once() or else it'll keep recalculating itself.

0 Kudos