Create Form with multiple entity

I want to create this form

First i fill name and then select Multiple locations. on the bases of selection A row will be created with Time in , time out and those locations which i select with there input field, On clicking Add More button another row will create and so on.

And the data will save as ---- the Name will save in entity1, Time in and Time out with entity 1 identifier will save in entity2, and with each location a record will save in entity3 with entity 2 identifier. 

All the data will save on clicking Save button,

How i achieve this.

you can take the different entity createorupdate function in the save screen action. you have to place 3 different screen action in the save screen action and data source will be the form data.

i hope this will help you,

Thank you,

Sudip

You need to create a List for this.

First create a List and name it:

- SelectedLocations (LocationsIdentifier)
- TimeEntry (List of structure [order, timein,timeout, List of Location])

In your Preparation,
 * Load your locations entity with filters you applied on it.
 * On your location search field, set the action RefreshAjax on the Onchange property.

Onchange:

- Every time you click the checkbox of a particular location.
  you should append it on the List SelectedLocation and
  remove it if uncheck.

On Add More:
- Every time you click add more, just append a new list to TimeEntry List.
  set the timein and timeout to nulldate() or currdate() initially depends on your
  logic.
- Append the SelectedLocation on the List of location as part of the structure.
- Create an onchange action on timein and timeout so that every time you change
  then it will update the list as well.
(makesure you make an ajax refresh on the addmore section so that it would reflect on the field)

On Save:
* You need to have two entities for this.
   - TimeEntry
      - id
      - timein
      - timeout
   - TimeEntryLocations
      - id
      - timeentryid
      - locationid

Loop the TimeEntry List:
  - first you need to create a record of the looped list on TimeEntry entity so that it would return an id.
  - Loop the SelectedLocation

     - create a record of the SelectedLocation list on the TimeEntryLocation Entity.
       (make sure you set time timeentryid and the locationid.


On summary:
* Create a List
  - SelectedLocation (Location Identifier)
  - TimeEntry (List of Structure [order, timein, timeout, List of Integer(List of location identifier)])
* Follow these entity
 - Locations Entity
 - TimeEntry
 - TimeEntryLocation

Goodluck!

Reyco Seguma wrote:

You need to create a List for this.

First create a List and name it:

- SelectedLocations (LocationsIdentifier)
- TimeEntry (List of structure [order, timein,timeout, List of Location])

In your Preparation,
 * Load your locations entity with filters you applied on it.
 * On your location search field, set the action RefreshAjax on the Onchange property.

Onchange:

- Every time you click the checkbox of a particular location.
  you should append it on the List SelectedLocation and
  remove it if uncheck.

On Add More:
- Every time you click add more, just append a new list to TimeEntry List.
  set the timein and timeout to nulldate() or currdate() initially depends on your
  logic.
- Append the SelectedLocation on the List of location as part of the structure.
- Create an onchange action on timein and timeout so that every time you change
  then it will update the list as well.
(makesure you make an ajax refresh on the addmore section so that it would reflect on the field)

On Save:
* You need to have two entities for this.
   - TimeEntry
      - id
      - timein
      - timeout
   - TimeEntryLocations
      - id
      - timeentryid
      - locationid

Loop the TimeEntry List:
  - first you need to create a record of the looped list on TimeEntry entity so that it would return an id.
  - Loop the SelectedLocation

     - create a record of the SelectedLocation list on the TimeEntryLocation Entity.
       (make sure you set time timeentryid and the locationid.


On summary:
* Create a List
  - SelectedLocation (Location Identifier)
  - TimeEntry (List of Structure [order, timein, timeout, List of Integer(List of location identifier)])
* Follow these entity
 - Locations Entity
 - TimeEntry
 - TimeEntryLocation

Goodluck!

Hi Reyco, 

Can you plz send me an oml. that would be very helpful for me.