Query transformer

Hi All,

already sorry for my question, I am not a developer but I love to learn stuff and I am a bit stuck now. I have added my restapi to my query and that's working fine. My api is very limited in filtering and I want to add a filter through the transformer field. My filter would be the following

data --> category --> label --> "text value"

From the documentation I see the following but really not sure how to use that for my filter

Any help would be much appreciated

const data = {{query1.data}}

return data.filter(f => f.fieldToFilterBy.toLowerCase().indexOf(textInput3.value.toLowerCase()) !== -1 )

Schermafbeelding 2022-11-23 165223

Since I can't test this, I'm not confident, but I think it would be something like this:

const data = {{query1.data}}

return data.filter(f => f.category[0].label.toLowerCase().indexOf({{ textInput3.value.toLowerCase() }}) !== -1 )

Assuming there is only one category per item.

thanks a lot, did some more testing and figured a few error out, but now I am stuck with

data.filter is not a function

I'm not exactly sure why you're getting that error. However, it looks like you're trying to put the transformer on the query itself, and I don't think that will work.

I would recommend create the transfomer separately.

Here is a an app you can import that works for me.
test3.json (11.4 KB)

Of course, this is setup to filter against my own database, so the query and transformer would need to be updated to reference your specific data.

thanks for that, I will give it a try, and I did. Same issue :slight_smile:

  • message:"data.filter is not a function"

maybe this just doesn't work when using a rest api

Works fine for me with a rest api.

Working example:
filter.json (12.6 KB)