Populating form with data

0
Dear Mendix Team,   I am new to Mendix. I am posting here my business requirement and requesting your guidance in completing this.   We will have a entity with data as like below. This entity will be used to create the forms.      Users will open the below form and enter the data as "IOS10001" in column "IOSTagNo", then after that we should fill the remaining fields data from the above base entity. We have used "onChange" action on "IOSTagNo" column and able to fill the data for columns "TagDesc, Area and Complex" data using a microflow.    Now our requirement is when user enter the data as "IOS10001" in column "IOSTagNo" then we should be able to fill the form table with "AlternativeSafeguards" and "FurtherAction" columns data from above base entity.      Could you please let me know how we can fill the table with the above columns in Mendix?. Thank you for your time and efforts.    Thanks, Satish.
asked
1 answers
0

At first: I notice you think in concepts of forms. Within Mendix we talk about pages. And pages != forms in the technical sense.

Mendix uses objects in their pages to do something with data. Which could be show the data, manipulate the date, trigger some app logic etc.

 

A form can be seen as a interface with data, which is decoupled from the database.

Within Mendix objects are the link between your database and your front end (pages) in pages you are still dealing with objects. not with data in JSON/XML format which you need to map to objects (server) and records (database) .... please note Mendix also uses JSON in their server client communication. But is not what you do yourself and consider when modeling. Objects are the concept.

 

So why above? Because depending on your Business needs I can answer your question differently, making use of above.

 

Two scenarios I can think of:

  1. Look up data record from the database and use THAT record as object
  2. Look up data from a record in the database and use that record for a NEW object

For the first scenario you want to search and use. In that case I would not start with a pop up showing all. I would search through a list in a page using filter widgets.

If the requested UI is the way to go; I would do it las follows

  1. Create a page starting with a dataview with context of the queried Entity
  2. Create a microflow which creates a new (temporary) object of that entity and opens the page of step 1 passing the new object into the page
  3. Create an on-change event on the input text box, showing the IOSTagNo triggering a microflow
  4. Create the microflow as follows
    1. Input parameter object of entity type used in page dataview
    2. Retrieve from database from the Entity used, where IOSTagNo = $inputParameter/IOSTagNo Set Select first in the retrieve
    3. Add decision if object found
    4. If true
      1. Add delete object, deleting the temp object from input parameter
      2. Close page
      3. Show page; opening the same page again, but this time with the found object
    5. if false, end microflow

For the second the same as above, but when object found

  1. Add a change object
  2. set change members where you map the members of the found object to the new created object (your input parameter variable)
  3. Refresh in client.

 

Done

 

 

answered