"Return" multiple fields in a query with Transformer

(Update: Please see my response below for current question)
For the sake of simplifying what I want to do, say I have one drop down field referencing a SQL query for work orders. Basically I want it so that when a user enters a work order number in that drop down field, it populates the selected work order's description (from the SQL query) to another field's Value.

I don't currently have any table visible for work order selection and would like to keep it that way if possible. I tried setting the Description field's Value to reference the query data but it is telling me I can't reference an object. Is there some way on the query to set it as a Transformer that I can reference in the Value of the Description field? I'm a newbie to Retool and Java, any help would be much appreciated. I'm pretty excited about Retool and everything I've been able to do so far. - JB

Ah, I think I figured this out but may have a follow-up question. I set a transformer on the query where the work order is selected. The transformer shows as "return data.Description". I then referenced that transformer in the field I wanted populated. It shows in Default Value as "{{WO_Selected.data['0']}}".

My question now is this, can I set multiple returns on a query. Say there are other columns from the same query that I want to have populated to a different field, how do I do that.

For example, if I wanted to return both Description and Branch. Do I do it like this and just change the reference for branch to show as "{{WO_Selected.data['1']}}"? It doesn't throw any errors when I do this but it also doesn't populate the branch.
return data.Description
return data.Branch

Again NM, I figured it out.

I put "return data" in the Transformer of the query.

I then put "{{WO_Selected.data.Description['0']}}" in the Default value for the Description field AND
"{{WO_Selected.data.Description['0']}}" in the Default value for the Branch field

1 Like