Search for ZIP code with leading zero

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.

I am afraid I did not make use of script. :frowning:

All I did see below:

I do not believe it is possible to return display values using the query language.

You may need to manipulate your values once these are returned to your app.

But theen it is too late, I send a search number from app to sheets and need related numbers back in the app. And ZIP code can be 4 or 5 digits, up to country.

What is the difference from your code in post above
with my code.

Hello, may I ask question?
Your googlesheet with the 012345 had format 'text only' for the cell?

@Taifun

If you mean me, I did not set a format, so it was at default.

Yes and no :slight_smile: Thank you for the info

The Doit result for my seach field is '01' which is correct.
image
When I set cell format to text in g.sheets and do google search&replace for 01 also the text cell with 01234 is found.
The app search within the google.sheet works in a diffent way.?

Do you mean like this:

image

Tick Match entire cell contents?

No, nothing ticked / selected in the options.

If you do tick it, it will only match cell contents, and thus only return the cell with 01 in it.

The problem is that I have not only 01 in one cell, ZIP codes contain 4 or 5 digits, just starting sometimes with ZERO. When I tick exact match, I get no result for search'01' and '01*' :frowning:
I thing this sample shows quite good what I am looking for:


Just that the search should be zero one '01'.
Really annoing problem for me as some user already reported via email that a 01 search does result in empty search match.

If you are using gviz, use the LIKE operator

  • like - A text search that supports two wildcards: %, which matches zero or more characters of any kind, and _ (underscore), which matches any one character. This is similar to the SQL LIKE operator. Example: where name like fre% matches 'fre', 'fred', and 'freddy'. (Ensure you use the UriEncode block to properly encode the %)

or use starts with
SELECT * WHERE B STARTS WITH ''01'