hassaan_ayyub
hassaan_ayyub
AEAsh Elixir
Created by hassaan_ayyub on 8/30/2023 in #support
How to sort on a postgres regex?
I'm trying to extract a number from a text field using regex and sort on it.
require Ash.Query

def sort_on_regex(q) do
q
|> Ash.Query.sort([asc: expr(fragment( ... ))])
end

error: undefined function expr/1
error: undefined function fragment/1
require Ash.Query

def sort_on_regex(q) do
q
|> Ash.Query.sort([asc: expr(fragment( ... ))])
end

error: undefined function expr/1
error: undefined function fragment/1
Perhaps using calculations:
calculate :serial_no_int, :integer, expr( ... )
calculate :serial_no_int, :integer, expr( ... )
I can't figure out the syntax. Thank you!
3 replies