Filter by struct keys in a read action
So I have an ash actions.
It receives a struct as an input.
I want to create a filter that filters by values inside the struct.
here's a simplified version of the action:
I get an error like this:
Is there a way to get the key out within a filter like this, or will I need to filter the data in a different way?
Is the only way of doing this through a preparation?
2 Replies
probably just a typo in your post, but should
argument :instance, struct
be argument :instance, :struct
?
ie :struct
atom for the type
you may be able to use get_path
on arguments, so your filter would look something like: filter expr(instance_type == get_path(^arg(:instance), [:machine_type]))
there was some discussion over here: https://discord.com/channels/711271361523351632/799097774523547669/1034088336576491575cheers for the link, looks like at the time the discussion was had zac said you basically need to use a preparation, so that's what I've done! 🙂