How do i use contain expression trying to find certain zip codes

Tiger1
Participant V

I am using the contain expression to find zip codes. I cannot figure out how to add mutiple zip codes to search:

Current expression:
contains([last seen location] ,"77905""77976""77404""77905""77976""77404""77414""77483""77419""78075""78022""78071"“78385”
"78140""78159""77963""77993""77954""77967""77974""77989""77994""78141""78164""77975""77964""77984""77995"“77987”)

Solved Solved
0 15 425
1 ACCEPTED SOLUTION

I don’t think that will work mainly because contains is expecting text not a list. A nasty workaround would be:

OR(Contains([Last seen location], “77905”), Contains([Last seen location], “77976”),… )

This will check the string for each of the keywords. The OR expression will evaluate to true if any one of them are true.

View solution in original post

15 REPLIES 15

Steve
Participant V

You’re using CONTAINS() wrong:

You should be using IN() instead:

Thanks Steve…!

Does this look correct?

IN ("77905""77976""77404""77414""77483""77419""78075""78022""78071"“78385”
"78140""78159""77963""77993""77954""77967""77974""77989""77994""78141""78164""77975""77964""77984""77995"“77987”, list([last seen location] ))

It gives me a check mark - the expression is good.

However it is not finding those zip codes. Or it finds them but doesn’t show that item on my map. Here is a small view of my data:

Here is where i put that expression:

I believe it should be like this…Though @Steve is much more better than me with lists:

IN(
	{"77905","77976","77404","77414","77483","77419","78075","78022","78071","78385"
"78140","78159","77963","77993","77954","77967","77974","77989","77994","78141","78164","77975","77964","77984","77995","77987"},
	LIST([last seen location])
)

using that expression gave me an error:

LIST has elements of mismatched types

Do you want to find an occurrence of "77905""77976""77404""77414""77483""77419""78075""78022""78071"“78385” "78140""78159""77963""77993""77954""77967""77974""77989""77994""78141""78164""77975""77964""77984""77995"“77987” in the list consisting solely of [last seen location]? That’s what your expression tries to do.

I suggest you study the examples on the IN() help page.

I am trying to search the table column [last seen location] - for all those zip codes. If the zip code is there, i want the map to show that item on the map…

One more thing. I should have showed you the data table. The column [last seen location] is a full address - where i want to show based on zip only…

That’s pretty critical information that you should have shared earlier.

In order to accomplish what you want, the 5-digit zip code must be available as a separate column or must be easily extractable from the Last Seen Location column.

sorry. It just hit me to show the table column. So how do i extract it? I do not have a column with just zip code…

There is no good way to extract it with AppSheet.

Tiger1
Participant V

ok. Thanks

@Tiger
@Steve
How about:

CONTAINS(
	Tablename[LAST SEEN LOCATION],
	{"77905","77976","77404","77414","77483","77419","78075","78022","78071"“78385”
"78140","78159","77963","77993","77954","77967","77974","77989","77994","78141","78164","77975","77964","77984","77995","77987"}
)

I don’t think that will work mainly because contains is expecting text not a list. A nasty workaround would be:

OR(Contains([Last seen location], “77905”), Contains([Last seen location], “77976”),… )

This will check the string for each of the keywords. The OR expression will evaluate to true if any one of them are true.

Joshua - thanks. That worked!

Bahbus
Participant V

If your addresses are all standardized like that perfectly…

COUNT(
    INTERSECT(
        SPLIT(Table[LAST SEEN LOCATION], ", "),
        {"77905", "77976",...}
    )
)>0
Top Labels in this Space