Unable to Retrieve data from DB to display it in Dropdown

0
I’m working on a Project where I have to store the values and retrieve it to display it in another page..So I created a create object button and commited the values to get stored in DB..but I’m unable to Retrieve it to display the values in Dropdown created in other page..Please help me out with step by step process to tackle this situation..
asked
2 answers
1

Step 1: Create an Entity

  • Go to the Mendix Modeler and open your project.
  • In the "Domain Model" section, create a new entity by right-clicking on "Domain Model" and selecting "Add" > "Entity."
  • Name your entity, and add attributes that you want to store. For example, if you want to store names in the dropdown, create an attribute called "Name" with the data type "String."

Step 2: Create a Form to Input Data

  • Go to the "Pages" section in the Modeler.
  • Create a new data view page by right-clicking on "Pages" and selecting "Add" > "Data View Page."
  • Drag and drop the entity you created in Step 1 onto the data view page.
  • Add an input widget (e.g., text box or drop-down) bound to the "Name" attribute of the entity to allow users to input data.

Step 3: Create a Microflow to Save Data

  • Go to the "Microflows" section in the Modeler.
  • Create a new microflow by right-clicking on "Microflows" and selecting "Add" > "Microflow."
  • Inside the microflow, add a "Create Object" action to create an instance of the entity you created in Step 1.
  • Map the input values (e.g., the value from the input widget) to the corresponding attributes of the entity.
  • Add a "Commit" action to save the object to the database.
  • Optionally, you can add validation and error handling in the microflow.

Step 4: Create a New Page with Dropdown to Display Data

  • Go to the "Pages" section in the Modeler.
  • Create a new data view page by right-clicking on "Pages" and selecting "Add" > "Data View Page."
  • Drag and drop the entity you created in Step 1 onto the data view page.
  • Add a drop-down widget bound to the "Name" attribute of the entity to display the stored values.

Step 5: Create a Microflow to Retrieve Data

  • Go to the "Microflows" section in the Modeler.
  • Create a new microflow by right-clicking on "Microflows" and selecting "Add" > "Microflow."
  • Inside the microflow, add a "Retrieve" action to fetch all the objects of the entity you created in Step 1.
  • Optionally, you can add sorting or filtering if needed.
  • Return the list of retrieved objects as the output of the microflow.

Step 6: Call the Microflow and Display Data

  • On the page created in Step 4, add a microflow button or nanoflow button.
  • Configure the button to call the microflow created in Step 5 to retrieve the data.
  • Bind the drop-down widget on the page to the list of objects returned by the microflow.
  • The drop-down will now display the stored values retrieved from the database.
answered
1

you can use a reference selector and in the reference selector, you can setup the data source by mapping it to the exact attribute.

You could also write a custom microflow in Selectable objects section where you can build a custom list and display.

answered