Javascript Query in Query Library

Could the ability to create javascript queries be added to the query library? Would enable the ability to share javascript functions across apps.

7 Likes

+1 to this. would be really useful for sharing javascript queries across apps.

Is there a workaround for this?

Hi there!

Not currently :disappointed: Depending on your use case, you might find Preloaded Javascript helpful: https://docs.retool.com/docs/custom-js-code#preloaded-javascript

I'll post on this thread when we ship a fix!

I'm probably a little late to this, but we have been using a temporary workaround via modules.

It is done by creating a module that intake data, have a JavaScript query do whatever you want with the data, and export the query.data as an output.

Hope this helps!

1 Like

I am surprised it has taken me this long to realize the potential utility to have JS queries in the Query Library.

Since it could probably not see the calling app's state, I can see some limitations that would be fine with me:

You would need to pass all state into the query and return a result to communicate with the app. If the JS query triggered any other queries, they would need to themselves be on the query library.

My use case is I am running a series of actions that are duplicated in three different apps. They were rather simple until the client wanted them to do a lot more. There is no good way to modularize the actions as Modules do not have a "reason"able and reliable way for the parent to trigger one of it's query on demand.

I cannot use external or preloaded javascript as I need to run a few queries.

3 Likes

Thank you for sharing these details, @bradlymathews! I shared this feedback internally as well :slightly_smiling_face:

Have there been any new updates/features on this?

Not yet :disappointed: This is still in our backlog queue, so I don't have an eta, but I'll add your +1!

Have there been any new updates on this?

Welcome to the community, @DiegoAnchor! There still isn't a great solution to this particular problem, but we're currently working on something that represents an evolution of the Query Library. This new feature is in early alpha testing but definitely supports JS queries. :+1:

I'll update this thread when we enter the next phase of testing and start expanding access!