lardcanoe
I’m adding a visual query builder, and https://react-querybuilder.js.org/ seems like the most robust one.
It will be used with Ash resources, some of which will have embedded schemas.
I’m looking for a gut reaction, or recommendation, on the best way to hook these up.
First is mapping Ash resources to its field format, which is like:
const fields: Field[] = [
{ name: 'name', label: 'Name', datatype: 'text' },
{ name: 'birthday', label: 'Birthday', datatype: 'date', inputType: 'date' },
{ name: 'guitars', label: 'Guitars', datatype: 'number', inputType: 'number' },
{
name: 'favoriteMovie',
label: 'Favorite Movie',
datatype: 'text',
operators: [{ name: '=', label: 'is' }],
},
];
Second, is taking its output, and mapping that to an Ash Query filter. There are numerous export options, see Export | React Query Builder, and I couldn’t tell which would be the best starting point.
Thank you!
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
Ash actually accepts a map syntax for its filters
you’d pass a map into
Ash.Filter.parse_input.A small note about it in the docs: Ash.Filter — ash v3.29.3
Edit: I assume you aren’t using liveview?
lardcanoe
k, I had stumbled on Ash.Query.html#filter_input/2 Ash.Query — ash v3.29.3 so I can munge it to conform to that.
I am using Liveview. I just didn’t want to spend a day or two making a simplistic version of the react query builder. Or were you going somewhere else with that? If I manage to get this PoC to beta, maybe I would rip out the react tools with custom liveview ones.
To construct the fields for the builder, something like
MyApp.MyResource.spark_dsl_config[[:attributes]]seems like my best starting point. Agree?zachdaniel
So, we have the data structure for backing a filter form, but not the UI, meant to be used with live view. It can be a bit complicated to wield, but once you get it working it’s quite useful. Check out
Ash.FilterForm. Maybe someone from the community can provide an example implementation/tips. I know @frankdugan3 has used it, among others. Would like to work up an example and better docs, haven’t had the chance.dblack
Here’s an example implementation of Filter form
https://github.com/totaltrash/filter_form_example
zachdaniel
Oh, right, how could I have forgotten! That’s a great example
thanks @dblack
jakeboone02
Maintainer of React Query Builder here. I’m not familiar with this framework but this post came up in my Google alerts. If there’s anything I can do or questions I can answer about RQB, let me know!
lardcanoe
FilterForm is pretty cool. Thanks for pointing that out!
The one shipped in ash_phoenix seems to be missing relationships. A demo you posted in Zach Daniel posted on LinkedIn shows relationships being used. Any thoughts on how that was accomplished?
The users of this feature are used to writing their own SQL, so I’m tempted to just let them write some JSON which gets converted to a Map that is compatible with Ash.Query.filter and just move one with life and build the UI later. This was one of those “if it is quick to implement, do it, otherwise move on” features.
That being said, can user text input, like
first_name == "Zar" and last_name in ["Doz", "Daz"] and high_score > 10be passed to any of the Ashfilterorexprfunctions, or is that bonkers?Thank you to everyone!
zachdaniel
Unfortunately no, there is no text based filter parser, although writing one that ships with ash core is doable. But not going to happen any time soon