Select to view content in your preferred language

Can you have multiple constraints/choice filters on an external select?

4317
8
02-05-2018 04:15 AM
IngridAldridge1
Regular Contributor

I am attempting to create a select one question based on the x,y location of the geopoint.  Preferably I wanted to have all assets within a 50m radius of the surveyor's location appear in the drop down.  It does not appear that you can use greater than or less than within the choice filter.  So, I have modified the process to use x and y locations rounded to the nearest 100.  This is working as expected on a subset of data in the choices tab.  However, it is not working at all with the external_choices tab.  I have tried forcing the attributes to integers int() which did not help.  I've attached an example  for reference.

0 Kudos
8 Replies
by Anonymous User
Not applicable

Hi Ingrid,

Yes, you can use multiple fields in the choice filter with external selects (such as x and y). I had a look at your survey and have been able to get it working with just a few minor changes. Note that as you have 50,000+ choices in your external choice list, the survey is very slow to load and respond. Unfortunately this is because you are pushing the limits of the application using such a large choice list which must be searched/filtered with every focus change.

Firstly, the pulldata() function is a string function and causes the field type in the app schema to be created as a string and any further calculations to be processed as a string, this can cause issues with field type mismatches when doing numeric calculations. The calculate questions you used were created as field type string in the app, check the schema preview. Even though you set the esri field type to double, this only applies to the feature service, and not the field being used in the app. Therefore we must manually set these calculations fields to decimal. You can do this in two ways, change the question type to decimal (not calculation), however then these fields are no longer hidden from the user, but you could make them read only.

The other option is to use the bind::type column to set the two final calculations fields to be of type decimal, which will keep them hidden, and your calculations and choice filters will work as expected.

I also cleaned up the xlsx file by removing the un-needed select one and associated choice list and columns in the choices sheet, only leaving the fields and options needed to get this to work correctly using the external select. Also note I added a test record to your external choice list so that it would work based on my location, don't forget to remove it. Updated xlsx file is attached. 

Hope that helps.

Regards, Phil.

DougBrowning
MVP Esteemed Contributor

Are you sure you can use two different columns in the lookup?  I was testing this all day yesterday and for sure mine will only use one column.  In fact the column must be one set name.

My detailed post is here

https://community.esri.com/message/762088-can-externalchoices-use-more-than-one-lookup-column-and-qu...

Thanks

0 Kudos
DougBrowning
MVP Esteemed Contributor

This turned out to be commas and other special chars in the list!  Thanks to Esri for finding.

It seems like you cannot use != in a choice filter.  If I do layer != ${nonplant} I get nothing.

Thanks

DougBrowning
MVP Esteemed Contributor

Can you use an If statement in the choice filter?  I cannot get it to go.  external choices are used here.

LRR_NAME=${LRR_Choice} and if(${MajorSoilType}="HistosolOrHistic", HistosolOrHistic=${ForLookups}, if(${MajorSoilType}="ClayeyOrLoamy", ClayeyOrLoamy=${ForLookups},Sandy =${ForLookups}))

I want to change which column I do the lookup based on another question.

I also tried to use the field name to create the lookup column name and that did not work either.  Would be slick though.

${MajorSoilType}=${ForLookups}

thanks

LRR_labelnamelabelHistosolOrHisticClayeyOrLoamySandy
A- Northwestern ForestNoneNone
A- Northwestern ForestA1_HistosolA1-HistosolY
A- Northwestern ForestA2_Histic EpipedonA2-Histic EpipedonY
A- Northwestern ForestA3_Black HisticA3-Black HisticY
A- Northwestern ForestA4_Hydrogen SulfideA4-Hydrogen SulfideYYY
A- Northwestern ForestA11_Depleted Below Dark SurfaceA11-Depleted Below Dark SurfaceYY
A- Northwestern ForestA12_Thick Dark SurfaceA12-Thick Dark SurfaceYY
A- Northwestern ForestF1_Loamy Mucky MineralF1-Loamy Mucky MineralY
A- Northwestern ForestF2_Loamy Gleyed MatrixF2-Loamy Gleyed MatrixY
A- Northwestern ForestF3_Depleted MatrixF3-Depleted MatrixY
A- Northwestern ForestF6_Redox Dark SurfaceF6-Redox Dark SurfaceY
0 Kudos
DougBrowning
MVP Esteemed Contributor

For now I created Dups in the list and put the column name in as the lookup value.

Like this

LRR_NAMELRR_labelnamelabelSoilType
AA- Northwestern ForestNoneNone
AA- Northwestern ForestA1_HistosolA1-HistosolHistosolOrHistic
AA- Northwestern ForestA2_Histic EpipedonA2-Histic EpipedonHistosolOrHistic
AA- Northwestern ForestA3_Black HisticA3-Black HisticHistosolOrHistic
AA- Northwestern ForestA4_Hydrogen SulfideA4-Hydrogen SulfideHistosolOrHistic
AA- Northwestern ForestA4_Hydrogen SulfideA4-Hydrogen SulfideClayeyOrLoamy
AA- Northwestern ForestA4_Hydrogen SulfideA4-Hydrogen SulfideSandy
AA- Northwestern ForestA11_Depleted Below Dark SurfaceA11-Depleted Below Dark SurfaceClayeyOrLoamy
AA- Northwestern ForestA11_Depleted Below Dark SurfaceA11-Depleted Below Dark SurfaceSandy
AA- Northwestern ForestA12_Thick Dark SurfaceA12-Thick Dark SurfaceClayeyOrLoamy
AA- Northwestern ForestA12_Thick Dark SurfaceA12-Thick Dark SurfaceSandy
AA- Northwestern ForestF1_Loamy Mucky MineralF1-Loamy Mucky MineralClayeyOrLoamy

Hope it helps someone.

0 Kudos
AndrewPadilla
Frequent Contributor

Hello Philip Wilson‌  is there a list of functions which will work with the Choice_filter? As Doug Browning‌ mentioned I am unable to get != to work in the choice filter. Any suggestions? My goal , to get a list of other people in a household.

Workflow:

select_one person to survey >calculate Person type and Household ID.

select_one list of other members in household (choice_filter- HouseholdID=${HouseholdID) and PersonType!=${PersonType}. It does not work with != in the formula, but will if it is =. Thank you for your time.

0 Kudos
by Anonymous User
Not applicable

Hi Andrew,

Currently with the 3.10 release (or earlier) the choice_filter column does not support functions (expressions). The good new is we are working on this for the 3.11 release, allowing you to have more complex expression in the choice_filter column, thus allowing cascading selects and choice filters on select_multiple questions.

This is currently in beta and you can test it out with the 3.11 beta builds available on the Early Adopter Community.

Regards,

Phil.

AndrewPadilla
Frequent Contributor

Hi Philip Wilson‌ , Thank you for your response. I look forward to the enhancement.

Cheers,

Andy