Search for ZIP code with leading zero

Hello, may I ask you help once again.

I have a search for ZIP codes which looks up at a google sheet for entries.
But when I enter in the search field a ZIP code with a leading 0 nothing will be returned.
The google sheet has format for '0000' digits so that 04325 will be displayed correct.


Can I change something that the ZIP code with leading zero will be found.?

Thank you

This means the actual value (e.g. 4325) will be returned. All google sheets is doing is formatting for display in google sheets.

You would need to store your zip codes on google sheets as strings. Place an apostrophe before each zip code (e.g. '04325)

A rather long winded workaround would be to use a google apps script to return DisplayValues as an array, then you could search for the zip codes with leading zeros

1 Like

Hello, thank you for your commen.
When I add '09999 the vale will not be found with the search. :slightly_frowning_face:
Do I have to change something at the input field (for the seared number) as well?

Thank you again

Working OK for me...

image

Column A format is Automatic/PlainText

1 Like

Thank you. I can take a look at the weekend. :slight_smile:

Is it possible that within my TB_input TextBox the leading 0 get lost on the way to googlesheets.?
Displaying the 0 in the sheets is also no option as the 'only displayed' 0 (as unser format) will be ignored in the search.
Formating the ZIP as Text with '04103 has the effect the the googlesheet search can find it, which is basically good.
I belive I copied now all 3 related blocks:

Any suggestion are highly appreciated.
Thank you

Are you using numbers only for your textbox ?

Within the Designer there is no checkmark at NumbersOnly.

Have tested with textbox, still works OK for me

Show your full strSelectUrl

Show your raw responseContent

Sorry, how do I get this.?

strSelectUrl:

https://spreadsheet.google.com/tq?tqx=out:csv&key=1bvL5MHoh_sBUTECqna13rybD1AbC8AhBn5kso7mc6X8&tq=

Google sheet format is on AUTMATIC for colum B wher the ZIP codes are in.

You get the responseContent in the Web GotText event

Edit: taken from Tim's answer

Taifun

1 Like

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I hope I did it right.
Doit result:


Do It Result: select+B%2CC%2CD%2CE%2CF%2CG%2CH%2CI%2CJ%2CK+where+B+starts+with+%276%27

Is this the block result you need?
Search was for digit 4

Ok... and what is the response content?
Taifun

That is strange:


Wrong block picked by my side for DoIt.?

As previously advised, set the responseContent to a label, then run do it on the label text.

1 Like

Ups, sorry.
Label text result attached. Only the do it at the label text at both positions brings up:
Enter values for:
responseContent =
image



Setting goole sheet Format of colum B to Text only gets no search results.

Again looking into search results, I found this post:
https://community.appinventor.mit.edu/t/how-do-you-add-zero-in-front-of-number-in-google-sheets/60735/10?u=stefan_knackert

Now i struggle with this sentence:
need to use getDisplayValues instead of just getValues in other parts of your scripting

Would it work for my problem as well.? The result in the other topic look good.

I agree

You might want to post your script here to get help...
Taifun

In google apps script, if you are getting a set of data from a range, you can use getValues() to get the actual values (underlying values) on your spreadsheet. If you use getDisplayValues() instead, the script will get the values that you see on the sheet - the formatted values.