I have a dropdown of order names and I want that when I select a dopdown value, in a textbox its status appears

I have a database oapedidos which columns are id, nombrepedido and estadopedido,   in english id, order_name and status_name

e.g.

id  nombrepedido estadopedido

1     A1000             enviado

In my interface I have a dropdown Nombre Pedido populated  with  names of orders, in this case nombrepedido, and a textbox Estado Pedido, I want that when I select a dopdown value, in the textbox the status estadopedido appears associated with the name of the order nombrepedido

the code of the interface is:

{
  a!dropdownField(
    label: "Nombre Pedido",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Elija un pedido ---",
    choiceLabels: index(
      rule!GP_GetListaPedidosPorNombre(),
      "nombrepedido",
      {}
    ),
    choiceValues: index(
      rule!GP_GetListaPedidosPorNombre(),
      "nombrepedido",
      {}
    ),
    saveInto: {},
    validations: {}
  ),
  a!textField(
    label: "Estado Pedido",
    labelPosition: "ABOVE",
    saveInto: {},
    refreshAfter: "UNFOCUS",
    validations: {}
  )
  
}

My Data Store is

My CDT   is

 

My Cons Entity is

and my rule a!queryEntity is

Would I have to code another query to obtain the status of the orders through the name of the order, which previously I would have to save? In that case how would you do it?

 Discussion posts and replies are publicly visible