Replies: 2 comments
-
Hey, the easiest way to achieve this is by defining a custom def fields do
[
free_percent: %{
module: Backpex.Fields.Text,
label: "Free usage this month",
render: fn assigns ->
# user = ...
free_percent = Subscriptions.determine_quota(user).free_percent <> "%"
assigns = assign(assigns, :label, free_percent)
~H"""
<p><%= @label %></p>
"""
end
},
]
end in the custom Note that it sometimes may be better to use the |
Beta Was this translation helpful? Give feedback.
0 replies
-
That's what I've been looking for, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm currently migrating from Kaffy. I have several calculated fields, which base on business rules that are implemented in elixir. Kaffy supports this via passing a lambda to
value
.As far as I understand, computed fields in Backpex are currently only possible via
select: dynamic()
which extends the query.Is there also a way to display a computed field based on elixir code? For example:
Beta Was this translation helpful? Give feedback.
All reactions