How to Pre-populating a field when creating a New sub-record?

Hello Appsheet community,

I have quite an interesting scenario/complication that I wanted to share and see if anyone has a solution.

Lets start by giving some background: I'm building an app for managing the distribution of products to clients, and for that I have these tables:

  • COMPANIES (it is the table with generic main company information)

  • CONTACTS (table with contact information from people working in such companies)
         - There is a column "contactCompany" that references the COMPANIES table

  • BRANCHES (information of branches of the main company)
         - There is a column "branchParentCompany" that references the COMPANIES table

  • DELIVERIES (Details of a specific Deliveries made by the Branches)
          - In this table there are these columns
                   - "deliveryBranch" that references the BRANCHES
                   - "deliveryParentCompanyContact" that references the CONTACTS table

So, there are moments when I'm creating a new Delivery order for a new Company and this is the process I go through:

  1. Go to a "Table" view where I can see all my "Deliveries" and click on the (โž•) button to add a new delivery.

  2. The "Deliveries_Form" view is displayed, and I have to select a Branch for the deliveryBranch column. But since in this example I'm creating a new Company, I need to select the option to create a NEW Branch.

  3. The "Branches_Form" view is displayed, and in similar way I need to select a Company for the branchParentCompany column, but since I'm creating a new Company, I need to select the option to create a NEW Company.

  4. The "Companies_Form" view is displayed, and I add all the information for the New company and click on "SAVE" (but so far the company is not yet created).

  5. Then I see again the "Branches_Form" view where I can add all the other needed information and click on "SAVE" (and similarly, so far the branch doesn't seem to get created yet)

  6. Then I see again the "Deliveries_Form" view where I need to select a Contact for the deliveryParentCompanyContact column, but since this was a new Company, then I need to create a new Contact, so I select the option to create a NEW Contact.

  7. The "Contacts_Form" view is displayed, and I need to select a value for the contactCompany column... but I would like to have this value Pre-Populated with the company I had just created in Step 4... but I don't seem to know how to do this...

Any idea on how I can go about doing this?

 

Solved Solved
0 2 115
1 ACCEPTED SOLUTION

You haven't mentioned a complaint about what issue(s) you are trying to address.  Since it appears you are performing NEW functions from the dropdowns, I assume the issue you wish to resolve is the need choose the new company again and again.

It sounds like maybe you might want to update the relationships between Customers and their Branches/Contacts.  You want to establish a "tightly coupled" parent/child relationship between these.  It's simple.  In each of the child tables - Branches and Contacts - you should already have a Ref column where you assign the Company reference.  In this column, on each table, turn on the "Is part of" property.

This does a couple of things for you:

1)  In the Customer Form, when the [Related Branches] and [Related Contacts] columns are added, you will be shown automatically an input table with NEW buttons.  Tapping these will do the same as you are doing now BUT the Customer value is automatically assigned into the row.

2)  Should you ever delete the Customer row, all associated child rows are also deleted - automatically.

I hope this helps!

View solution in original post

2 REPLIES 2

You haven't mentioned a complaint about what issue(s) you are trying to address.  Since it appears you are performing NEW functions from the dropdowns, I assume the issue you wish to resolve is the need choose the new company again and again.

It sounds like maybe you might want to update the relationships between Customers and their Branches/Contacts.  You want to establish a "tightly coupled" parent/child relationship between these.  It's simple.  In each of the child tables - Branches and Contacts - you should already have a Ref column where you assign the Company reference.  In this column, on each table, turn on the "Is part of" property.

This does a couple of things for you:

1)  In the Customer Form, when the [Related Branches] and [Related Contacts] columns are added, you will be shown automatically an input table with NEW buttons.  Tapping these will do the same as you are doing now BUT the Customer value is automatically assigned into the row.

2)  Should you ever delete the Customer row, all associated child rows are also deleted - automatically.

I hope this helps!


@WillowMobileSys wrote:

In this column, on each table, turn on the "Is part of" property.


 

And, that was the solution! Very simple! Thank you @WillowMobileSys if I could, I would give you 5 stars ๐Ÿ™‚ โญโญโญโญโญ

 

Top Labels in this Space