Search bar confusion

Hi,

Being learning retool for the last few weeks but I’m left confused. After finally understanding how to make a search box for my table I seem to hit a brick wall.

I’ve tried using my mongodb to make a search bar for a table in my app. I don’t know if my database information isn’t set correctly but I can’t get the query correct.

So

I moved to using googlesheets and proceeded to try this way.

The query shows it’s working - showing the search criteria and row correctly but; the table it self doesn’t filter.

All
Tutorials I have watched shows that soon as I search or type in the search bar the result should be filtered out and the only data showing.

Am I correct here or am I missing something?

Thanks in advance

Hi @Sielski !

Welcome to the community!

Would you mind sharing a couple screenshots on your set up?

If not - here are a couple things that could be going wrong:

  • You haven't updated your table to reference your new query JSON with SQL query
  • You aren't running your query JSON with SQL on search change
  • You are referencing the wrong dataset in your query JSON with SQL query or don't include a clause to filter the google sheet query

Hope these get you off on the right foot :slight_smile:

Hi Joey,
I am running with query JSON with SQL on my search engine
The dataset referenced in the search is correct {{ query.data }}

Pls, how do you suggest the table can be updated to reference my new JSON with SQL query?

Hey @Chilaka, welcome to the community :hugs:

Could you share some info about your setup? maybe a couple screenshots?

1 Like


The google sheet is the data source
searchloanid and searchName are queries for the filter circled above


But when I input values in the filter, the rows don't come up

1 Like

Hey @Chilaka
For this, you would have to format your query data into an array first.
In the main(parent) query Add a transformer to serialize your response data into an array.
It will solve your issue.

1 Like

I added this in the transformer of the main query


the text filter did not improve

Hi @Chilaka

With the transformer, does readQuery return an array of objects? That is the format we need.

Can you share a screenshot of the response from readQuery in the left panel (expanded out to see the data). It should look something like this:

Another thing that might be helpful to test, is removing the where clause. Do the Query JSON with SQL queries work if you only query select * from {{readquery.data}} ?

If that is the case, we may need to check the where clause syntax or data type

I'm linking our docs for this query type as well!

Hi @Tess Thanks for your response.
I could not complete the other project due to this. But I have another one and it requires the same process


Here, I queried JSON with SQL (removing the where clause), and the query ran successfully returning arrays

But when I add the filter where campaign ilike {{'%' + textInput1.value + '%'}} , the values I input in the textinput does not take effect
NB: campaign is the second column in the table
th

Hi @Tess I have spotted my error, thanks. When I checked the JSON values in the array after putting the where clause, I realized it had the impact I wanted

So the solution was I just needed a component to help me visualize the result. Thanks again

1 Like

Oh, nice! :tada: Glad it's solved! Thanks for letting us know

1 Like

Hello @Tess , i have same problem. When i have add Transformer in the main(parent) query, the result doesn't appear. But when i disabled, the result was appear


Hi @andretan

It looks like RSVPForm.data is already an array, so searchSheet should also return an array. Adding a transformer to make the data in searchSheet an array after it is already formatted in that way is expected to return no results.

If you change your transformer to just return data, it should work :crossed_fingers:

hi @Tess , myproblem already solved. Thank you :slight_smile:

1 Like

Glad to hear!