Restrict submission of form if geopoint is not set within the correct city?

109
1
07-17-2020 09:37 AM
ŽeljkoPušec
New Contributor II

Hello, after I used pulldata on geopoint to extract full addres to field named "address", I used this calculation in .xls form for a required question: "Is geopoint within Zlatar Bistrica city?":

if(contains(${address},'Zlatar Bistrica'), 'yes', null)

So, the result is that form can't be submitted if the geopoint is set ouside the city.

 

Now I'm working on a same form for a neighbour city called "Zlatar". But if I use analog calculation:

 

if(contains(${address},'Zlatar'), 'yes', null)

it is obvious that a geopoint can be set in city "Zlatar Bistrica", because contains "Zlatar" . It shoudn't be posible, so how can I write a calculation for an address that must contain "Zlatar" and must NOT contain "Zlatar Bistrica" at the same time? 

Thanks very much!

0 Kudos
1 Reply
JamesTedrick
Esri Esteemed Contributor

Hi Željko,

One way to go about this is to also check to make sure the address does not include Zlatar Bistrica:

if(contains(${address},'Zlatar' and not(contains(${address}, 'Zlatar Bistrica'))), 'yes', null)

I will note that null is not a valid keyword or function in XLSForm - '' represents an empty value.

0 Kudos