What is the best way to populate a dropdown ?

I need the managers list while adding an employee . i have an employee and manager table . 

while creating an employee , i need to populate managers list so that HR can assign the manager to an employee . in the interface i need to populate the Manager dropdown .

 

Option 1 

 

--Create a query entity to fetch all the managers 

--get the data subset 

-- initialize local!managers:rule!getManagers()

and display like below  

a!dropdownField(
label: "Manager",
labelPosition: "ADJACENT",
placeholderLabel: "--- Select a Manager ---",
choiceLabels:{index(local!managers.data,"name")},
choiceValues:{index(local!managers.data,"name")},
value: ri!manager.name,
saveInto: ri!manager.id,
validations: {}
)

 

are there any better approach ?

  Discussion posts and replies are publicly visible

Parents
  • I dont understand the concept of storing in process model.  Wont the process have to retrieve the data first even before it can be passed to the UI and cause the UI delay in rendering anyway?

    Also dont understand where Josh says if the user opens the UI everytime, the local variable in the load function will be populated every time but isnt that the case with process model as well?  If the user closes and opens the UI again wont a new process model instance be created?

    I have a similar need for a pricing tool where I need to populate a dozen dropdowns with albeit very small data sets but I need to frequently look up multiple RATES tables based on the drop down values selected.  The RATES tables store records from about to 20 to 200 rows and I have about 10 of them!  ANY IDEAS?

Reply
  • I dont understand the concept of storing in process model.  Wont the process have to retrieve the data first even before it can be passed to the UI and cause the UI delay in rendering anyway?

    Also dont understand where Josh says if the user opens the UI everytime, the local variable in the load function will be populated every time but isnt that the case with process model as well?  If the user closes and opens the UI again wont a new process model instance be created?

    I have a similar need for a pricing tool where I need to populate a dozen dropdowns with albeit very small data sets but I need to frequently look up multiple RATES tables based on the drop down values selected.  The RATES tables store records from about to 20 to 200 rows and I have about 10 of them!  ANY IDEAS?

Children