Combining two tables to create single form and storing data in respective two tables

In Outsystems IDE, I have two tables(one to many relationship) Employee(EmployeeName,Address, DOB) and Course(CourseName, Duration, Fees). I want to create a form with fields "EmployeeName" , "Address", "DOB","CourseName","Duration","Fees". On submitting the form, data needs to be saved in Employee and Course tables.  How can I achieve this in Outsystems? 

Hi Preethi,

Since you have a one to many relationship, I'm not sure what you want to achieve. I would find it strange if I could edit a person's details (name, address, dob) when I would be editing a course, or adding a course.

I know this isn't an answer to your question, but your requirement is a bit strange, and I first want to get straight what you actually are trying to achieve.


Preethi S wrote:

In Outsystems IDE, I have two tables(one to many relationship) Employee(EmployeeName,Address, DOB) and Course(CourseName, Duration, Fees). I want to create a form with fields "EmployeeName" , "Address", "DOB","CourseName","Duration","Fees". On submitting the form, data needs to be saved in Employee and Course tables.  How can I achieve this in Outsystems? 

Actions and Code Reusability Exercise

Video


Hi Preethi,

As mentioned by kilian, The Requirements is kind of strange. If you want to display the details of the employee and courses that he applied in the same screen, Then just add two lists for them and display it on the single screen and 

For adding/Updating courses, you can create a popup for that and that should help you to develop the requirement.

Thanks 

Kirit

Hi Kirit kumar

      I want to save data in single form into two different tables. As an admin I need to enter employee name and corresponding courses in the same form that will be stored in Employee details table and course details table. Is it possible?

Hi Preethi,

Again, your functional requirements are strange. Why would you need to _enter_ an employee name? You want to _search_ for the employee, and for that employee select a course?

I have a similar situation. Did you find the answer to your question? Does anyone know the answer to the question?  


Hi Jorge, 

It is very simple to do it, but have some quirks. 

First, this approach should not be used to update a record, as the form will be able to show only one of the course records. Unless you know how to choose the correct record. 

To simplify, if you are just creating the first Employee / Course, you can do like bellow (updating will not create a new course) 

1. In the aggregate in preparation, join the two tables, doing the appropriated filter by the employee I'd, not Course. When passing NullIdentifier to the Employee I'd input parameter used to filter, you will create a new record. 

2. Use the current of the previous Aggregate's List as source to the Form. Now, the Form.Record has two entities: Employee and Course. 

3. Drag & Drop both entities to the form. Do any changes you like. 

4. In the Save Action, you now can save separately the Employee and Course records from the Form.Record. Just be sure to save first the Form.Record.Employee and assign the CreateOrUpdateEmployee returned Id to the Form.Record.Course.EmployeeId before saving the Form.Record.Course.

Cheers 

I am a just trying to learn.   I am building a database to store customers and locations and contacts.   A customer can have many contacts and many locations (Jobsites).  On my form to enter a new customer I need comapany or residentail homeowners name, address and contact information.   I am stuck at this point.  (as you can see very early)  I could have 3 tables as shown below One to many Customers to Contacts and Locations

CUSTOMERS (CustomerName) Etc

CONTACTS (CustomerId)(ContactName), (Phone1), (Phone2), (Email) Etc.  

LOCATIONS (CustomerId)(LocationName)(Address1)(Address2)(City)(State)(Zipcode)

Or I could have everything in one recursive table by adding two fields (record type ie Customer Contact Location) and ParrentId     ???????