Select to view content in your preferred language

eSearch Query

1097
7
12-10-2019 05:13 PM
JeremyWolff
Emerging Contributor

Hi, I am trying to find out how it would be possible for users to query a spatial layer using the code name for each area by using three different expression values. 

The data is relevant to ecosytems and vegetation and looks like this: 

ecosystem typeveg1veg2veg3Landzone
1.5.1/2.5.11.5.12.5.1null5
2.2.22.2.2nullnull2
2.2.2x1a2.2.2x1anullnull2

1.5.1 represent three values for Bioregion.Landzone.Vegetation types 

Sometimes the vegetation type has an extention number:

 

1.5.1x1a 

I am only trying to let people be to query on the dominant vegetation type which is the field veg1 and always the first veg type.

Bioregion has only 12 values so my first expression value is Start with (predefined values) : (1.,2.,3.,4. and so on with labels such as 1. North West Highlands, 2. Gulf Plains and so on. 

My second expression is the Landzone with only 12 values as well which I have predefined in the same way.

Both expression seems to work great for the first values: Bioregion and Landzone.

However I have difficulties creating an expression for the third number: vegetation type. I was wondering what would the community suggest, perhaps using an SQL code that would force the query to look at the last number and return all the extention types as well?

I have tried to predefined values with End with expression all the vegetation type numbers as (.1%) so that if the user types (vegetation type 1) the they will get the vegetation type 1 areas and all the extention that they don t know about as well. But that also returns features like  2.1.3 and 2.3.11

It would be great if there was a way to add an expression with an SQL that will allow the user to search for the dominant ecosystem type by being able to search vegetation type (the last number) and juste type a number from 1 to 50. And if they typed 1, it would be great if they only get values that end with .1 and .1a, .1b .1xa..  and not .11.

screenshot

Thanks for you help, 

Jeremy

widjets #sql  #enhanced query#feature query‌ 

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus

Jeremy,

   There is no support in the UI for such complex queries. What I mean is the the eSearch widgets settings dialog can not support building a query that would work for this, but the widget itself can support a complex query that is needed for this. You just have to manually edit the widgets config.json file to alter the sql text. This is what the sqlText would look like:

[value][a-z]%

This means [value] = the value the user enters in the input window (i.e. 1.5.1)

[a-z] = means that the value above must be followed by a non numeric value 

% = means that the non numeric value can be followed by any length of alpha numeric characters.

So the expression would find 1.5.1, 1.5.1a, 1.5.1b, 1.5.1xa and NOT find 1.5.11

0 Kudos
JeremyWolff
Emerging Contributor

Hi Robert,

Could you walk me through that process again. I might be doing something wrong because as soon as I modify a config.json file the app won’t work and I get this sort of error message:

Cannot GET /webappbuilder/apps/2/widgets/widgets-manifest.json

:3344/webappbuilder/stemapp/jimu.js/ConfigLoader.js?wab_dv=2.14:1144 Widget is removed because it is not loaded successfully. widgets/LayerList/Widget

Should I be modifying the config.json file in

WebAppBuilderForArcGIS\server\apps\2\configs\Query

Or in

WebAppBuilderForArcGIS\server\apps\2\widgets\Query

Then just save in notes and refresh my webpage?

Best Regards and thank you for your help!

Jeremy

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jeremy,

   Sorry I thought this question was about the eSearch widget. If that is the case then I am not sure why you are modifying the Query widgets config.json.

0 Kudos
JeremyWolff
Emerging Contributor

Hi Robert,

Well it seems that the neither query widget nor the esearch widget would support the queries that I am trying to create:

“expression would find 1.5.1, 1.5.1a, 1.5.1b, 1.5.1xa and NOT find 1.5.11”

Therefore, I am trying to modify one or the other. In that case could you let me know which file should I modify exactly please?

Regards,

Jeremy Wolff.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jeremy,

  As I mentioned the eSearch (and neither the query widget) are not setup for complex queries like this. But 

but the widget itself can support a complex query that is needed for this. You just have to manually edit the widgets config.json file to alter the sql text. This is what the sqlText would look like:

[value][a-z]%

I do not have your data or your configuration to be able to test what exactly you must must be manually put in the eSearch config.json. So the best thing for you to do is provide me your eSearch config.json where you have the first two drop downs working and I can see if I can get the sql expression I provided to plug into what you already have.

0 Kudos
JeremyWolff
Emerging Contributor

Hi Robert,

Thank you for your help.

For some reason the eSearch widget works when I create a new app but does not when I add it to the app I have been developing. But let’s solve one problem at a time.. : )

Just one question which is unclear to me before I reconfigure the eSearch widget and send it to you.

When you say : “You just have to manually edit the widgets config.json file to alter the sql text.” Where is that file?

· WebAppBuilderForArcGIS\client\stemapp\Enhanced Search ?

· WebAppBuilderForArcGIS\server\apps\2\widgets\eSearch ?

· WebAppBuilderForArcGIS\server\apps\2\configs\eSearch ?

Config.json file are everywhere and they all contain lines like these “"sqltext": "ZONING_TYPE = '[value]'",”

If you could just point out to me which one should I try to edit with [a-z]% I would be happy to give that a try myself.

Kind Regards,

Jeremy Wolff

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jeremy,

   OK. So yes there are several config.json files but when you create an app the only one you are concerned with for that app would be the one in the apps configs folder. I.e:

WebAppBuilderForArcGIS\server\apps\2\configs\eSearch

0 Kudos