Search with criteria

Hello,

**UPDATE VERSION 2 !!! **
I made a new version, see here:

version 1:
I made a script for searches with several criteria and options.
2 search criteria that can be combined by And or Or.
An option to respect capitals and another option for accents.

The integration is pretty straightforward.
The idea is a table with the search parameters with a template column grouping all the parameters. Then in the table to perform the search, make a single value column with the parameters template and a YC column for the search.



Here is a small demo application.

YC link
https://Search-And-Or.manun2.repl.co

Source

8 Likes

Hello @Manu.n, just feed for thoughts of an approach less advanced than yours, but without using the YC (for non experts as I am)

Hello,
Spurred on by @Jeff_Hager , I made a new version. :stuck_out_tongue_winking_eye:
There is only one criteria search which can be a list of words (full or partial) or a word or phrase in “” for an exact search. I also added a few more options. See the detail below:

VERSION 2

* Parameters
 * 
 * String: string to search
 * 
 * Separator: use of a specific character to separate the elements of an array. 
 *            Returns the elements found separated from the same separator.
 *            (Search for example in a 'Joined List').
 * 
 * Escape characters: replaces the characters with a space, allows searches 
 *                    to be insensitive to certain characters 
 *                    (such as for example city names with a '-')
 * 
 * Search: search criteria, either a list of words (complete or partial) to search, 
 *         or a word or an expression between "" for an exact search
 * 
 * Uppercase: uppercase Sensitive.
 *            (1 : active, 0 : inactive (default))
 * 
 * Ignore Accent: ignore accents in the search.
 *                (1 : active, 0 : inactive (default))
 * 
 * Word: searches only whole words
 *       (1 : active, 0 : inactive (default))
 * 
 * ------------------------------------------------------------------------
 * Remarks
 * Spaces at the beginning and at the end are automatically removed.
 * The order of words in the search does not matter.

Demo

Link YC
https://Search-V2.manun2.repl.co

Source

6 Likes

HI all,
is it possible to make the “experimental code” column to be “user specific”? I was not able to do it…

Hello @
Uhmm no the YC column is like a calculated column (math, template, …).
To do a user-specific search, the entry columns (search and option) are specific.

I mean…it would be user specific if it’s referencing a user specific column…

@Manu.n I understand that the choices would be user specific, but also the results should be. Is @Robert_Petitto meaning that if the result is based on user specific columns, the result would be different for any user?
To make it an easy question, have you tried this app with multiple users? Do they get to search and get different results contemporarily?

The experimental code column, and any glide calculated column for that matter, will run on each user’s device, so it’s going to run with whatever value is available to that specific user. If you pass it user specific column values, then the result will be user specific. If you pass it a value that’s available to everyone, then everyone will get the same result. But no matter what, that code runs on the user’s device, so the result will be based on the values that are being passed to it from that user’s device. It will not effect other users.

3 Likes

Thanks @Jeff_Hager therefore it will work!

1 Like

For information :
I would love to be able to share this application, but with the presence of a YC column this is not possible.

Hi @Manu.n I am trying to integrate your search code into my app, but I am not understanding exactly how to do it. Up to now, I have done the following:

  1. In the main data tab, I have created a template column cumulating all the text to search within

  2. I have added 7 user specific columns, each one for the parameters you use: “String”, “Separator”, “Escape”, “Search”, “Uppercase” (boolean), “Accent” (boolean), “Word” (boolean)

  3. I have added an Experimental Code column, linking to your code, and indicating for each parameter the respective column

  4. I have added an If-Then-Else column indicating IF the Experimental Column is not empty, write “FOUND”, else leave it blank

Obviously it does not work… and I kind of understand why. The search parameters should leave in one row, but the search should be conducted on all the rows. So, I think I messing up the mechanism a little…
Can you help? Thanks

Hello @POWH_RPS
All is well.
you just need to add for each parameter modified by the user a column like single value to repeat in the whole table.
Here is a sample structure of my sample lookup on the user table.

1 Like

Thanks @Manu.n it works great!

1 Like

@Manu.n I can’t seem to get the right result with your sample app.

Is it simply looking for a match with at least one word? e.g., “de”

EDIT. I ended up building my own repo with the Flexsearch library.

Is there a native solution to ignore the accents in search? I mean, without dealing with this more advanced mod.

I think you could do that with the remove text accents plugin. Then take your inline list and target the new plugin column.

To add to this, Eric meant you should add a user-specific column and have a text entry at the top of your screen to mimic the native search.

Then, on the backend, create a computed column to remove accents, and then use that result to show/hide items in the inline list.

2 Likes

I solved it… I shared what I did in this thread: Request for a better "search bar" capability - #15 by jorgeleon

2 Likes

Hi @Manu.n,

Your script seems great!

In your opinion, is it still the best options given the current evolutions of Glide?

Thanks

Not the right Manu here but the so clever Manu n

1 Like