Populate the repeat_count for external_choices

714
2
Jump to solution
02-28-2021 12:01 PM
MeleKoneya1
New Contributor III

We are creating a survey for facilities in our City Parks.     The number of facilities and the items to be inspected varies from park to park.   One park may have two facilities with six assets (rooms) to inspect while another park may have three facilities with 10 assets to inspect.    We would like to be able to populate the repeat_count for facilities based on how many are at a give park and we would like to do this for the repeats for assets and items to inspect. 

list name                                             name                                  label                           park_name_list

facility_nameAQUATIC_CENTERAquatic CenterCACTUS
facility_nameRESTROOMSRestroomsCACTUS
facility_nameCOMMUNITY_CENTERCommunity CenterELDORADO
facility_nameAQUATIC_CENTERAquatic CenterELDORADO
facility_nameSOUTH_BUILDINGSouth BuildingELDORADO
facility_nameAQUATIC_CENTERAquatic CenterCHAPARRAL
facility_namePARK_OFFICESPark OfficesCHAPARRAL
facility_nameRESTROOMSRestroomsCHAPARRAL

 

How can I count the number of facilities by park in the above example and then count the number of assets by by facility name from  below

list name                                     name                                  label                           park_name_list   facility_name_list

asset_nameCOMMUNITY_ROOM_1Community Room #1ELDORADOCOMMUNITY_CENTER
asset_nameKITCHENKitchenELDORADOCOMMUNITY_CENTER
asset_nameMENS_ROOMMen's RoomELDORADOCOMMUNITY_CENTER
asset_nameWOMENS_ROOMWomen's RoomELDORADOCOMMUNITY_CENTER
asset_namePOTERY_ROOMPottery RoomELDORADOCOMMUNITY_CENTER
asset_nameCLASSROOM_3Classroom #3ELDORADOCOMMUNITY_CENTER
asset_nameOFFICESOfficesELDORADOCOMMUNITY_CENTER
asset_nameHALLWAYS_LOBBYHallways/LobbyELDORADOCOMMUNITY_CENTER
asset_nameENTRANCEEntranceELDORADOCOMMUNITY_CENTER
asset_nameGYMGymELDORADOCOMMUNITY_CENTER
asset_nameOFFICESOfficesELDORADOAQUATIC_CENTER
asset_nameMENS_LOCKER_ROOMMen's Locker RoomELDORADOAQUATIC_CENTER
asset_nameWOMENS_LOCKER_ROOMWomen's Locker RoomELDORADOAQUATIC_CENTER
asset_nameMENS_ROOMMen's RoomELDORADOSOUTH_BUILDING
asset_nameWOMENS_ROOMWomen's RoomELDORADOSOUTH_BUILDING

 

We are able to limit the choices by using a  choice_filter like this for facilities

park_name_list=${park_name} and facility_name_list=${facility_name}

and this for assets

park_name_list=${park_name} and facility_name_list=${facility_name} and asset_name_list=${asset_name}

 

select_one park_namepark_namePark
select_one_external facility_namefacility_nameFacility
   
begin repeatFacility_LocationsLocations
select_one_external asset_nameasset_nameAssets
   
begin repeatInspectionsInspections
   
select_one_external inspection_iteminspection_itemItem
select_one inspection_ratinginspection_ratingInspection Rating
textnotesNotes
select_one yes_nowork_order_submittedWO Submitted
select_one yes_nowork_order_completedWO Completed
imageInspections_imageImage
end repeat  
end repeat  
   
integerasset_countAssets

 

Thanks Mele

 

 

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Hi. I cannot think of an obvious way to count list elements using an XLSForm expression. Could you create a CSV file listing the facility count? If so, you could use the pulldata function later to get the value and apply it to the repeat_count. Same for the assets.

View solution in original post

2 Replies
IsmaelChivite
Esri Notable Contributor

Hi. I cannot think of an obvious way to count list elements using an XLSForm expression. Could you create a CSV file listing the facility count? If so, you could use the pulldata function later to get the value and apply it to the repeat_count. Same for the assets.

MeleKoneya1
New Contributor III

Ismael,

I was struggling to find a way to do this and one thought I up with after other attempts,  was to do what you suggest with pulldata.  I wanted to see if I was missing something, but it sounds like that what you suggest will give us what we want.   

Thanks for the response and your suggestion on how to tackle this     

0 Kudos