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
I have a problem with my dropdown when I select a value from it, the dropdown automatically changes its value to the placeholder without staying fixed on the value I selected
a!localVariable( local!selectedValue : null, local!dropDownList : rule!GP_GetListaPedidosPorNombre(), { a!dropdownField( label: "Nombre Pedido", labelPosition: "ABOVE", placeholderLabel: "--- Elija un pedido ---", choiceLabels: index( local!dropDownList, "nombrepedido", {} ), choiceValues: index( local!dropDownList, "nombrepedido", {} ), value : local!selectedValue, saveInto: { local!selectedValue, /* create QE to get Estado Pedido name by nombrepedido*/ a!save( local!EstadoPedidoName, if( isnull(save!value), {}, rule!getEstadoPedidoBynombrepedido(nombrepedido : save!value) ) ) }, validations: {} ), a!textField( label: "Estado Pedido", labelPosition: "ABOVE", value : local!EstadoPedidoName, saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ) } )
This query is correct?
PD: Sorry my ignorance I am a intern
Thanks it's works finally!
a!localVariables( local!dropDownList: rule!GP_GetListaPedidosPorNombre(), local!selectedValue : null, local!EstadoPedidoName, a!sectionLayout( label:"Nombre Pedido", contents: { a!dropdownField( label: "Nombre Pedido", labelPosition: "ABOVE", placeholderLabel: "--- Elija un pedido ---", choiceLabels: index( rule!GP_GetListaPedidosPorNombre(), "nombrepedido", {} ), choiceValues: index( rule!GP_GetListaPedidosPorNombre(), "nombrepedido", {} ), value : local!selectedValue, saveInto: { local!selectedValue, a!save( local!EstadoPedidoName, if( isnull(save!value), {}, rule!GP_GetPedidoEstadoPorNombre(nombrePedido: save!value) ) ) }, validations: {} ), a!textField( label: "Estado Pedido", labelPosition: "ABOVE", value : local!EstadoPedidoName, saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ) } ) )
and the query I have extracted from this url which is also a topic of mine
how-get-the-value-from-a-dictionary