I want to get the status_name when running an action on a table that only has the status_id.
i.e.
IF getOrdersTable.data.status_id
EQUALS getStatus.status_id
RETURN getStatus.status_name
Currently, I am manually writing it out like this which I know is not the way!
{{variantsTable.recordUpdates[0].priority_id === 4 ? "Express Order" : variantsTable.recordUpdates[0].priority_id === 5 ? "Internet Order" : variantsTable.recordUpdates[0].priority_id === 6 ? "Wholesale Order" : 'Stock' }}
Might joining the tables together in just one query do what you want?
select orders.order_id, orders.status_id, status.status_name
from orders as orders
join status as status on status.status_id=orders.status_id
If you want to keep the queries separate you can us e JSON SQL query to do this:
select orders.order_id, orders.status_id, status.status_name
from {{formatDataAsArray(getOrders)}} as orders
join {{formatDataAsArray(getStatus)}} as status on status.status_id=orders.status_id
Thanks Brad.
I would normally do a join, but this has come up a few times and I thought there might be a better way, given that I run the getStatus query anyway to use in the dropdown tag mapped data.
I might just do the join if that it's the optimal way forward.
Cheers!
Hi Jason, we are currently building a building an inventory management solution where we are providing full APIs for typical activities in this domain. This should make the implementation way faster. Would you be open for a short call where we could learn more about the use case you are currently building? Cheers, Akio