0
votes

I have two tables as entities.

  1. Travel details
  2. Travellers

I will have the trip details in first table and "who is travelling list" as separate records in second table.

Here are my screens:

enter image description here

After I fill the travel details, I should hold the data somewhere and pass it to the next page and collect travellers. It is one to many relationship. One trip might have one or more travellers. Finally I should submit these to my two different entities.

Since I'm new to powerapps, it's quite challenging for me. Please help.

2

2 Answers

1
votes

I would suggest to store the travel details ID (or whatever the primary key of the travel details table is) as a variable (context or global depending on how you want to do this) when the travel details are saved on the first screen, and then modifying the OnSelect property of the save button on the second screen to include the information stored in the variable when it writes to the Travellers table. I realise this is not very clear, but more information about the data structure and the current OnSelect property of both save buttons would help.

0
votes

Try a combination of a Collection with incrementing rows and Patch. Collections are basically a table of variables.

You could instantiate the Collection when navigating from the first screen. This will create a table of ALL variables in your app (even for Traveler1, Traveler2, etc but with null values).

Then after the user enters Travelers, the Submit button would Patch the travelers info into the table.

Something like:

  • Screen 1, Add Travelers button, OnSelect property:

    ClearCollect(<collection_name>,
        {
            travel_type: <name_of_dropdown>.Selected.Value,
            from: <name_of_dropdown2>.Selected.Value,
            traveler1_first_name: " ",
            ...etc for EVERY variable you will have on BOTH screens
        })
    
  • Screen 2, Submit button, OnSelect property:

    Patch(collection_name,
        {
            traveler1_first_name: name_of_textbox.text,
            traveler1_last_name:  name_of_textbox2.text,
            ...etc, etc
        });
    SubmitForm(name_of_form)
    

This should get you a good head start on a solution.

Cheers