Create a search form and display the result in a box


I am looking to make a search engine that will look for information in a table that has 3 columns, one of which is ignored in the search.
according to the key words, ten results should be displayed below and then we could choose / select the results and by clicking on them they would be gathered in a third field.

in this third field where the chosen result is displayed, it would be possible to click on it in order to display all the content of the result in the form of a pop-up for example.

I create a kind of mockup, please have a look.

Anyone can help me about this ?

Thanks very much

This layout can work but right now when I search for a card it only search in one row,… here for example the first one, the title

How can I choose 2 rows to search in ?
kind of advanced search form…

Hi @Julien_Ferla and Welcome back to the Community :partying_face: !

I’m not sure if this will fulfil your needs here or work as you wish, but maybe this is something you could explore or play round with :blush: .

(Sorry, I’ve accidentally hit the “send reply” button… I’ll be back in a jiffy with a full reply :sweat_smile: )

Sorry for the delay @Julien_Ferla :innocent:

So, based on the description you gave in your post, I’ve actually made different sample docs that could give you some ideas (maybe :innocent: ) but I’m just going to share the one which I think could be the closest to what you’re trying to achieve :blush:

In the sample you’ll find below, I’ve begun to build a table to store the values to look for : It’s the Source table you’ll find on this page.

Now, I didn’t know if you wanted an exact search or a partial one … So I chose the exact search :blush:

In my Source table and because I relied on Lorem Ipsum to test this (so maybe I pushed this a little bit too far for no reason :sweat_smile: ), you’ll see there’s a [Column 2] and a [Column 3] where I entered some lines of Lorem Ipsum :blush: .

Next to these 2 fields, you’ll find 2 other text fields called [Column 2 - Keywords] and [Column 3 - Keywords].
Those 2 fields have the sole purpose to list all the unique words (converted to lowercases) from [Column 2] and [Column 3] so they can be searched for later.

There are also 2 buttons: [Select Column 2] and [Select Column 3].

What they both do when pushed is simply copy the text in [Column 2] OR [Column 3] in the field Selected Result.
(I didn’t have enough time to think how that would work if someone would like to select both the [Column 2] AND [Column 3], sorry :innocent: )

They are both disabled if the list of words within their respective “Keywords” fields doesn’t contain the word entered the [Search Box] OR if thisRow.[Selected Result] is not blank (as it means that something has already been selected).

The last field in the Source table is a simple button to expand the row once either the [Column 2] OR [Column 3] has been selected :blush:

Now, on the Search and Results page, you’ll first see a simple canvas text control ([Search Box]) which is used to enter a term you wish to look for :blush:

Under it, there are 3 canvas formula returning the rows from the table Source where :

  1. CurrentValue.[Selected Result] is blank (because it means that nothing has been selected yet)
  2. either [Column 2 - Keywords] or [Column 3 - Keywords] contains the word entered in [Search Box]

And because you said you wanted to limit the number of results to 10, just under the canvas formula returning all possibilities, there are 2 other canvas formulas doing the same thing as the previous one but limiting the results returned by the formula to 2 using Slice() (I only created 5 rows in the Source table so 10 wasn’t very limiting :sweat_smile: ).
One is limited to the first 2 results and the other the last 2 results :blush:

The rows returned by the very first canvas formula are then used to filter the card view of the Source which is called [Search Results (All)]

For the view to return only 2 results, the filter can be adapted and instead of using [All Search Results] you can use one of the 2 other canvas formulas :blush: .

I actually had to externalise the filter here and have a canvas formula displaying the appropriated rows because Slice() didn’t seem to work in the filter of the view :woman_shrugging: .
So, to workaround that I used those canvas formulas :blush: .

You can of course hide the callout with the canvas formulas on another page (maybe the page with the Source table) :blush:

And, just under the card view Search Results (All), there’s another filtered view of the Source table called Selected Results where the results that have been previously selected in Search Results (All) appear :blush:.

The pink button is there to expand the row :blush:

I have a similar sample doc but it returns partial search results (using ContainsText())…

Again, this is just an imprecise idea :innocent:
But I hope it will help you a little :blush: .

Wow, thank you for this warm welcome!! :smiling_face:

and thank you very much for this answer, I will try to implement your solution in my document… and I will come back to give you a feedback.

Thank you very much for all the time you took to answer me!

Have a nice day

it looks very good! I have two questions…

currently I can’t always enter text in the search field,…I tested on the browser and also in the coda app and I have the impression that sometimes it bugs.

Maybe the work you did goes a little too far compared to what I need :smiley: sorry if my explanations are not detailed enough…

currently in a table I have a “lookup” field in visual table > cards where I can add “cards” whose content is in “source”.

I would like to be able to enrich or add a search function that will search in the different contents of the “source” table as you did and then choose the card and therefore add it either in the lookup field or in a new field.

and then do a second search and add a card again to finally have several cards in a “result” field.

In concrete:
In a table have an advanced search which will look for content / response in different columns, keywords of a source table and which allows to add them in a lookup column or a new result field.

Example use:

A source table with foods, their names and descriptions
Title: a banana
Description: this fruit is yellow and super good and rich in potassium, pleasant in summer

Title: Watermelon
Description: a perfect fruit for summer

A “recipe” table

a field “add your food”

Search: “summer”

Two cards are displayed “+ add / selected this card”

and in the “recipe” table or another.
the chosen cards are added

hope it’s more clear …
ant thanks again for your help !!

Oh no worries :wink: !
It was a fun exercise which allowed me to do a tiny bit of RegEx and I’m always glad to do a little RegEx as RegEx is not my forte :smiling_face: .

Well, with the context you added, I created a little something which leaves me a bit unsatisfied but I’m unable to find what bothers me exactly :thinking:
Anyway, it might still help you or give you some ideas :blush: .

The page you’ll see in the sample just below is the “search engine” I came up with based on the context you added :blush: .
It’s a detail view of the table Recipes where the lookups I used for the Ingredients are displayed as cards :blush:.
The first lookup field ([Search results]) is the one finding the rows (through a formula) from the table Ingredients based on the value in the text field Search.

The second lookup field (Ingredients), under [Search results], is also a lookup from the table Ingredients but it’s the lookup where the ingredients are send once they are “selected” (which is done by clicking the blue button you’ll see in the cards).

In the cards, there’s also a purple button to expand the row :blush: .

As for the grey button next to the Search text field, it simply reset the text field to Blank ("").

I’ve also added a field under Search to count the search results in case no match were found (so you would know that at least, the doc tried… but there was just nothing to find :blush: )

The blue button next to it, is there to create an ingredient (it simply adds a row to the table Ingredient and uses the term in Search as the Name for the new row), in case, again… there is no search results but you would still like to add that ingredient and link it to the recipe :blush: .

Both tables Recipes and Ingredients are on the page in the doc called “Recipes & Ingredients” .
(The sample will probably look a little bit better opened in its own tab’)

I’m sorry I can’t give you more explanations as I’m very short on time :no_mouth:.
But I hope this will still help you a little :innocent:

Wahou It look amazing !!

Why it seems so simple for you !?? :sweat_smile:

I will try to test it in my workflow and let you know but I think you give me a great tool for my needs !!!

Thank you so much !!

So I made a copy of your doc and modify a bit to fit as I need.

The problem is that: Now we have a search page - juste one view.
But I need to easily create more pages, for example the search page became a book for recipe 1 (example)

if I do it right now the second page (second book) I create won’t work (can’t add the ingredients to the recipe book 2 )

Page 1 - Pasta book

  • recipe 1
  • recipe 2
  • recipe 3
  • Page 2 - BBQ book

  • recipe 1
  • recipe 2
  • recipe 3
  • Page 3 - ingredients
    with only the ingredients

    Hope it’s understandable :wink:

    I managed to make it work as I wanted,…
    no need to modify the shared doc!!

    Thank you very much, I’m moving forward on my side and I’ll let you know


    have a nice day

    1 Like

    It was not “that” easy and took me a little bit of time to get there :wink:.
    And I also didn’t had the time to fully test everything :innocent:.

    So I think I should leave a note here regarding the workflow:

    :information_source: The “search function” works one search at a time and I’m not sure it will work as expected when it comes to selecting an ingredient from the search results if you perform multiple searches at the same time.
    (i.e.: In the table Recipes the text field Search which acts as the “Search Box” shouldn’t be left with some residual value of a previous search :innocent: )

    So, the general workflow here should be :

    In the view of Recipes, selected one recipe, perform one search, select the Ingredients, perform another search, select the Ingredients … and when you’re done with the selected recipe, clear the “search box” :innocent: .

    I’m very glad to know you got it working as you wanted :grin: !
    Congrats :raised_hands: !

    But just in case, to answer your previous questions :

    This was already feasible in the sample I previously shared :blush:

    To create a new recipe, you would just need to click on the + at the bottom of the “left pane” displaying all the recipes in the detail view :blush: (then search for ingredients to add …)

    This could be also done by adding a button to the Recipes table with an Action formula such as :


    So, it would just add a row in the table Recipes when pushed and the name of the brand recipe would be Blank ("").
    But this is just an example…

    As for the rest, you could just add a lookup field to group the recipes “per book” and use this lookup field to filter the detail view of Recipes :blush: .

    So, you either create multiple views of the table Recipes and apply a specific filter to each of the views …

    Or use a single view of Recipes and an Interactive filter to filter the view by group :blush:

    … which is what I chose to do in this sample :blush: .
    (Once again, the sample will probably look a better when opened in its own tab’)

    Using the Filter bar would have been an option too here…

    But well, this is just in case someone, someday, might need something similar :smiling_face:

    Have a wonderful day too from your side of the screen :sunflower: !


    :wave: Me again…
    you really impressed me! Thanks again.

    I just have a problem implementing in my work.
    The selected result won’t work … and I really don’t understand what I done wrong, sorry again for this.

    But I made some modifications in the order and in the views of your work, so I think I lost something on the way but I don’t know what and where :sweat:

    I copied my structure down below like this maybe you can help again :smiley:

    Hi again @Julien_Ferla :smiling_face: !

    I’ve quickly modified the broken formula in the button :blush: !
    Which seems to work now :innocent: .

    I’ve took the liberty to rename the fields Search, Search Results and Copy of Search Results in Recherche, Résultat(s) de la recherche et Points sélectionnés respectively, thinking it might help :blush: .
    (English is not my first language :wink: )

    I’ve voluntarily left the sample you shared (Thanks for sharing :raised_hands: ) with an active search for poum for which I selected 3 search results :blush: (now appearing in Points Sélectionnés )

    I hope this helps :innocent: !

    1 Like

    Thanks again !!!

    This is amazing what you can do with coda ,… you made me want to learn more how to properly use this tool !!

    you are very patient and kind !!
    these are just words but thank you so much !!! :pray:

    Last thing,… always have this problem how to transform the lookup in table
    it work:

    it don’t work


    Oh my … :smiling_face: ! Thanks for the compliments @Julien_Ferla :smiling_face: !
    I am just doing the best I can :innocent:.

    The difficulty here was to find a way to be able select a point from a specific search result :blush: .
    As the button to do this needs to be in the table with all the points (so it can be displayed where needed) while the search is effectively performed from the Anamnèse table :blush:

    For the subtable question, normally the “Table” toggle should appear when you hover the field with your mouse when you’re editing the detail layout of the Anamnèse table :thinking:.


    If you can’t find it, don’t hesitate to re-share your doc… I’ll take another look :blush: .
    (I can’t reproduce the issue from my side of the screen :no_mouth: , so I can’t say why you would have some difficulties to display the lookup field as a subtable)

    hun,… :thinking: I’m on ipad Pro 12.9 and it doesn’t appears when I hover it,… I think this is the problem… Maybe coda team can fix that ?!


    I will contact them to ask for.
    here the link to my final doc:

    let me know :wink:

    Found the issue @Julien_Ferla :blush: (and corrected the doc :wink: )

    The problem was that both lookup fields Résultat(s) de la recherche and Points sélectionnés were not linked to the table [Les points] anymore …

    So the lookup fields were somewhat appearing as simple select lists which well, can’t be displayed as subtables in a detail layout :smiling_face:

    Here’s what I found before correction :

    And here’s what it became after correction:

    Once I re-linked both lookup fields to the table [Les points] while editing the detail layout, the toggle to display the lookup field as a table reappeared and I was then able to display the subtable as cards, etc …
    You might want to check the card display though :blush: … I’m not sure if it currently looks according to your wish :innocent: .

    You also might want to check all the other lookup fields you use in the Anamnèse detail layout as they all (or almost all) appear “broken”.

    None of them seem to be linked to their corresponding table anymore, for some reasons :thinking: :woman_shrugging: .
    (Unless you only left some tables in the doc :blush: )

    Feels the detail layout editor might be a little buggy these days :woman_shrugging:

    I once again hope this helps :innocent:

    1 Like

    Yeah it works !!

    Thanks again :smiley: !! I wish one day I can thank you back and do something in return

    have a nice day

    See you

    My pleasure @Julien_Ferla :grin: !
    Always glad to help if or when I can :smiling_face: !

    I wish you, also, an amazing time from your side of the screen :sunflower: !

    1 Like

    Sorry I missed all the fun and I’m late to this party. I was also asked to build a search engine but with all fields in all tables for an entire enterprise workspace. The only rational approach was to build an Elastic-like index and then use the API to generate resuls.

    I needed to have wildcards and fuzzy search as well. This approach allowed me to also index object types and expose relationships. It took forever and a year to build but lots of use and satisfied workers who can find stuff quickly.