Lets say I have a dropdown - the options are bound to a named query that returns 3 columns. I have columns ID, x, y. Is there a way to have x,y show up on each option together?
You'll need a transform of some kind. Vision or Perspective?
Perspective
Why not do a separate named query for the dropdown and use the concat()
function to create the labels? e.g.,
SELECT ID as value,
CONCAT(x, " ", y) AS label
FROM ...
Then bind the dropdown's props.options
to that named query.
1 Like
Going the pure Binding/Transform route:
# This example uses an incoming JSON query value with known columns of "id", "name", and "quantity".
# Adjust for your scenario. Remember to adjust for potential TypeErrors.
def transform(self, value, quality, timestamp):
options = []
for option in value:
options.append({"label": " ".join([option.name, str(option.quantity)]), "value": option.id})
return options
3 Likes