I guess this
`${system.search}` !== "{}" ? "yes params" : "no params"`
Don't love it. Probs a better way
Every use case I've had, I could a test a specific query param.
What's your use case?
why do you need to check the search itself instead of a specific parameter?
Ah nice will try. Ty @John Siciliano
It's due to filtering in base row. I'm hiding and showing a set of filters using a mix of lookup and check boxes. It's very specific work around for a filter page.
I still don't really understand why you can't check for specific search oarams
because im not always using search params.
some times my filter uses the url as a filter
/bitcoin-gambling
and when the user adds perams i want the params to take over not the url
in base row im linking this slug to lookups to return the items
then when the user adds params i overwrite it and just use the params then if the user clears them i go back to using the url filter instead.
there are definitely better ways to do this. but not sure how within the boundaries of the expression editor.
you mean if there are no params you use the path, that's understandable, nothing wrong here, but I still don't understand why knowing the potential params you don't check for specific names, maybe if I see some code I will get it
checking for all my filters would be quite large
i found a way to increase the amount. instead of following the tut. i just use a starting and trailing filter that acts as a buffer so i get my commas. then i just make all the other filters show or dont show based on usage. This means i can have infinite. just means i need to block the filters when results are 0. or when the user enters a few.
doing it the tut way it just wont let me have this many. baserow limits it
technically i probably should just do the whole thing in cusotm code
uhh,I see, I guess having a search parameter that's always there when any filter is applied would potentially help, kinda like filters=true
im assuming that would need to be in the url right though. im trying to keep it clean
if i wanted to do the whole filtering system without the search perams i would prob have to write something custom right. nothing in webstudio that does this atm?
yes it would, don't see a big prob though
I guess if we expose Resource via direct JS API, you would be able to set all those things from client-side js instead of using an expression
yeah thats would be nice. have a little more control if you want to get more complex
Hm.. one idea, can you try getting rid of all the lines breaks in the query? I recall having an issue with this one time where the builder handled the break fine but not the live site. Though it wasn't on baserow tbh.. just seems like a good place to start
oh thats a big query. save it on a file just in case this isnt the problem and you want to bring the line breaks back π
this is it in one line. My texter editor makes it easy
My guess is that its not all line breaks but some... in notice some things like attached
Also I think you need commas after each filter. This is an array so idk how it's not complaining about them
I'm probably misreading it though. Syntax checker is smarter than me π
yeah i did some magic with commas so they allow for infinite filters. the first one has the comma the and the last doesnt. this means if they are alone they finish the filter without issues. the rest show or dont entirely with a comma added. so they can be passed in or out without errors
cleared all teh spacing and still has the issue sadly.
Can you remove anything in the query that isn't needed for loading just the url /some-test? E.g. all the search queries
ok to simplify things i created a new project and it doesn't seem to work on prod for that either
also this setup breaks the frontend on live. just perpetual loading but is accepted in app
Is this issue rooted in this? Not just the loading but the issue with query results
Yeah seems it's all around the !== {}
As it's the same. Works in editor but not on live
hm lets try to find a different way to do that. I never liked it from the start and this confirms its bad. Anyway from your side you change anything to look for specific params? I'll try to think of a code solution too
i tried a few variations but filtering wont work. created a reduced version to test
Not sure if I was clear, usually I'm not π
Is there a way to approach what you're doing differently so you can just test for a list of params? E.g. if params "a", "b", or "c" is present, then do what you need to do otherwise assume no params?
hmm you mean my basic request without the if system.search is empty. just request params and hide the perams if they are not in use
https://api.baserow.io/api/database/rows/table/375112/?user_field_names=true&size=${$ws$dataSource$YWj_m_T8dDGrvTTeYUo3b}&page=${!$ws$dataSource$oVo2lkbOKualabQnxnS7q.search.page ? 1 : $ws$dataSource$oVo2lkbOKualabQnxnS7q.search.page}&order_by=-Rating&include=Slug,Name,Canada Tracking,Features Lookup,Crypto Options Lookup,Sports / Esports Lookup,Country,Rating,Crypto options,Welcome Packgae CA,Canada-French Tracking,Logo Images,Anonymous,End to End Crypto,Crypto Options Count,Sports / Esports,Providers CA,Features&Crypto options__join=Name,Logo,Token Abreviation&filters={
"filter_type": "AND",
"filters": [
{
"type": "contains",
"field": "Country",
"value": "Canada"
}
],
"groups": [
{
"filter_type": "OR",
"filters":[
{"type": "has_value_equal", "field": "Features Lookup", "value": "${$ws$dataSource$oVo2lkbOKualabQnxnS7q.params.slug}"},
{"type": "has_value_equal", "field": "Sports / Esports Lookup", "value": "${$ws$dataSource$oVo2lkbOKualabQnxnS7q.params.slug}"},
{"type": "has_value_equal", "field": "Crypto Options Lookup", "value": "${$ws$dataSource$oVo2lkbOKualabQnxnS7q.params.slug}"}
]
},{
"filter_type": "AND",
"filters":[
{"type": "link_row_has", "field": "Crypto options", "value": "${$ws$dataSource$oVo2lkbOKualabQnxnS7q.search['bitcoin'] && 105}"},
${$ws$dataSource$oVo2lkbOKualabQnxnS7q.search['bcgame-dollar'] ? '{"type": "link_row_has", "field": "Crypto options", "value": "107"},' : ''}
{"type": "link_row_has", "field": "Crypto options", "value": "${$ws$dataSource$oVo2lkbOKualabQnxnS7q.search['bcgame-coin'] && 106}"}
]
}
}
]
}
this OR and AND filters are the ones i want to pick between.
the OR is the one pulled from the slug
the AND is the ones that are dynamic based on the search params
i set it up here if you want to copy
Why is not sufficient to just let both groups exist by default and conditionally apply the filters within those groups if those search queries are there? Just tyring to wrap my head around it
but this would include both of them when i use the params.
so when i am on a slug page and the user searches using params i will get slug + params results
I want slug list then when the user searches i want params results only
In the current query, there are just 3 query param filters. Will there be more or just these 3?
lots more. i just stripped it down to 3 as it shows the basic functionality. the sandwich i mentioned before
ah okay so those 300 or so π
the OR list will just be this 3
its the AND list that will expand
What about what Oleg suggested? Getting "filters=true" in the URL.
Maybe you can create a hidden field and set it to true anytime the form submits? Resetting it would be a different story though..
yeah i need it to revert too. will just try to see other options. cheers for the help π
ok did it the most ugly way. just checked for every filter
means its an even bigger request
and i will have to manually update any additional filters in 2 places
in that case even Johns workaround with checking "{}" is better if that works
only in app not on production
what's the value in production?
should be the same actually
i have a test page minus all my stuff
i added 2 variations. the one at the top encapsulates the system.search before running the validation the one below does it all in one. both dont work on a live site but work perfectly fine on the preview
I made it load if you make it not strict checking ie making !=
instead of !==
, but the filter doesn't work so I didn't pass this on