Customize search? Make it search a table?

Hi everyone

I have a simple home inventory app, with tables for items, categories and locations.

But when Iโ€™m on a โ€œviewโ€ in the app that shows categories, clicking the search icon at the top just searches categories. Iโ€™d like to make it instead search items. Is that possible?

If not, can I hide that top search icon?

The other issue Iโ€™m having is that โ€œsearchโ€ is so literal. Searching โ€œUsb cableโ€ finds an item called โ€˜usb cableโ€™ but not โ€˜usb black cableโ€™. Is there a simple way to fix that?

Thanks in advance for any help :)))

Toby

Solved Solved
2 18 6,367
1 ACCEPTED SOLUTION

Youโ€™re missing some important operators:
3X_1_2_126897cdd44128adab980415ddfa871e8dedb0d7.png

View solution in original post

18 REPLIES 18

Just go to Items view and search the category there. But please make sure you make the category column searchable.

I believe the search bar is searching for string like usb cable and not usb & cable

Thanks but I think you misread what I was asking completely ๐Ÿ˜•

Steve
Platinum 4
Platinum 4

No, it only searches the displayed table or slice.

Unfortunately, thereโ€™s no way to hide just the search bar but keep the main menu.

Depends on your definition of โ€œsimpleโ€. The built-n search feature is a simple exact-text search, as youโ€™ve noticed. You could implement your own search feature (but it wouldnโ€™t use the search bar), but itโ€™s not trivial, but it also wouldnโ€™t be horrifically difficult, either. You could also โ€œeasilyโ€ expand the scope of search while you were at it.

I understand we cant hide the top bar while keeping the (hamburger) menu.
But i noticed your sample app (community28312), doesnโ€™t have the search button on top. Where can I change that?

The search bar doesnโ€™t occur in form views.

That makes sense. Thank you.

The assistant is your best bet for searching the entire appโ€ฆ It actually works really quite wellโ€ฆ

Thanks guys! Assistant is so much better than search, youโ€™re right. Itโ€™s quite counter intuitive though - I wish I could make the โ€œsearchโ€ button return proper search results like the Assistant does (ie. Not only find perfect phrase matches but rather look for any combo of the search terms in its results).

But yes, looks like Iโ€™m stuck with hiding the search button (and also the menu!). ๐Ÿ˜• thanks though for your help!!

Now to work out how to craft an expression for my own search :))

I guess, in plain English, it needs to โ€œ**

take search terms, split it up into separate words, look for โ€œword 1 in table X columns A B C & D, AND word 2 in table X columns A B C & D, AND word 3 in table X columns A B C & D

**โ€ etc. Plus ideally it would then - after showing those results - show the โ€œorโ€ version of this.

Why do I suddenly feel like my โ€œno codeโ€ adventure with AppSheet is just turning into my standard PHP/MySQL coding?

Hmmmm anyone made these sorts of search expressions before?

Toby

Try:

FILTER(
  "table",
  ISNOTBLANK(
    INTERSECT(
      SPLIT(TRIM([_THISROW].[search terms]), " "),
      (
        SPLIT(TRIM([search target column 1]), " "))
        + SPLIT(TRIM([search target column 2]), " "))
        ...
        + SPLIT(TRIM([search target column N]), " "))
      )
    )
  )
)

Note that punctuators will confound the search some, as the SPLIT() above is strictly on (single) spaces.

Yup.

See also:





Thanks again Steve for your help!

Itโ€™s working, except it only wants to search the โ€œNAMEโ€ column. As you can see below, Iโ€™m trying to search NAME, STARNUM and DESCR_SIMPLE columns.

I tried adding an โ€œORโ€ but it gave an error. Help me, oh wise one! ;-))

LINKTOFILTEREDVIEW(โ€œL2_items_bottom_listphotosโ€,
ISNOTBLANK(
INTERSECT(
SPLIT(TRIM([_THISROW].[SearchInput]), " "),
(
(SPLIT(TRIM([NAME]), " ")
SPLIT(TRIM([STARNUM]), " ")
SPLIT(TRIM([DESCR_SIMPLE]), " ")
)
))
)
)

Youโ€™re missing some important operators:
3X_1_2_126897cdd44128adab980415ddfa871e8dedb0d7.png

Brilliant! Itโ€™s working!! Thanks!!

LINKTOFILTEREDVIEW(โ€œL2_items_bottom_listphotosโ€,
ISNOTBLANK(
INTERSECT(
SPLIT(TRIM([_THISROW].[SearchInput]), " "),
(
(SPLIT(TRIM([NAME]), " ")
+SPLIT(TRIM([STARNUM]), " ")
+SPLIT(TRIM([DESCR_SIMPLE]), " ")
)
))
)
)

The + trips me up because itโ€™s a plus but itโ€™s actually an โ€œorโ€, sorta. lol.

Please donโ€™t waste your Saturday replying to this today lol - but my next question isโ€ฆ If any of the columns contain โ€œbutterโ€, and I search for โ€œbutโ€, it doesnโ€™t return a result. Looking through all the functions, Iโ€™m assuming I need to add some sort of โ€œcontainsโ€ function. Iโ€™m just not sure where! lol

Seems to me that INTERSECT is doing the heavy lifting in the statement, yes? Itโ€™s finding whether there is any โ€œcommonalityโ€ between my search formโ€™s input and some columns in the table. And I need to tell it to โ€œdonโ€™t just look for exact matches, but partial matches are fineโ€. Hmmm.

No, itโ€™s a plus. See Constructing a List with Subtraction here:

Correct.

Thatโ€™s an entirely different requirement than you originally expressed. Iโ€™m not aware of a way to do partial matches with multiple terms from a single input without resorting to some ugly contrivances. Itโ€™s doable, but itโ€™s ugly.

Thank you Steve. I would gently suggest you open up new thread with tips and tricks category so that this sample app stands out!

Youโ€™re awesome, Steve! Youโ€™ve been so helpful to me. I really wish I had time to post all the stuff Iโ€™ve learned and a quick learning video as Iโ€™ve managed to do what I wanted (ie. make a full inventory app for myself) but it was extremely difficult, particuarly with the search issues but also with trying to implement a โ€œcategories /subcategories/subsubcategories/subsubsubcategoriesโ€ system in AppSheet. (Iโ€™m glad I already knew javascript/php/asp/mysql so I could figure it out, otherwise I would have been even MORE lost! lol)

I will check out your search thing when I get a chance!!!

Hello Steve: do you think it is possible to make a search engine that search for the exact text? For example, if I search for "red" in a given column, it only returns red and not redstone? Or if I search for โ€œcoldโ€ it only returns me columns with "cold" but not "coldplay" please.:)

That's what this entire topic is about. How does the solution given above not meet your needs?

Top Labels in this Space