cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Write to New Screen and Different SQL Table

I'm looking for resources or sites that could walk me through how to handle the situation I'll describe below. My searches came up without anything which is probably due to the wrong terminology.  My SQL tables are already setup to write correctly from the app

 

I have two screens:

 

Screen 1 - Writes to SQL Table General_Requests, primary key ID (auto increment)

Screen 2 - Writes to SQL Table Employee_Requests, primary key ID_Emp (also has ID to join back to General_Requests)

 

The requester fills out screen 1 about the request and then screen 2, to specifiy which employees they would like on their project.

 

When the requester moves from screen 1 to screen 2 - screen 2 should write the ID from screen 1 into the Employee_Requests table.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Write to New Screen and Different SQL Table

@TesDA 

Can you supply a bit more information about your application (galleries, forms, controls, formulas, etc) that might be helpful?

 

In general, if you are using a Form on screen 1 (let's call it Form1) and then need information from that form, you can use the LastSubmit property of the form.  More info on that can be found in the documentation.

 

So, on screen 2, you can use the Form1.LastSubmit.yourIdField to get that information.  Obviously, replace yourIdField with the name of your Id field you want to use.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Write to New Screen and Different SQL Table

@TesDA 

Can you supply a bit more information about your application (galleries, forms, controls, formulas, etc) that might be helpful?

 

In general, if you are using a Form on screen 1 (let's call it Form1) and then need information from that form, you can use the LastSubmit property of the form.  More info on that can be found in the documentation.

 

So, on screen 2, you can use the Form1.LastSubmit.yourIdField to get that information.  Obviously, replace yourIdField with the name of your Id field you want to use.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Helper V
Helper V

Re: Write to New Screen and Different SQL Table

@RandyHayes 

Let me know if you need anything else...

I'm working on a canvas app that uses forms, so far on Screen 1 I have:

ICWO_Entry_Form -> Form

3 DropDowns - Most using a selection from another table in SQL Server

 

I've attached a snapshot

Highlighted
Super User
Super User

Re: Write to New Screen and Different SQL Table

@TesDA 

That is all fine, and the suggestion remains as before - you can get to the ID of the form submitted in Screen 1 by referencing the ICWO_Entry_Form.LastSubmitted.ID value.

But, I dont' believe that Screen1 is your issue - you had said you needed this information on the screen2.?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: Write to New Screen and Different SQL Table

Yes, so Screen 2 would just be information about the employees the requester would like to request for their project (Employee ID, etc). This would write to a different table then Screen 1 (the employee request table). The foreign key of ID would still need to be the same as the primary key on Screen 1 so that the two can be joined (general information to foreign key). I havent started this screen yet.

Highlighted
Super User
Super User

Re: Write to New Screen and Different SQL Table

@TesDA 

Okay, so if you are making screen 2 as an EditForm, then for the datacard that needs the ID of the first table, you can set its default to ICWO_Entry_Form.LastSubmitted.ID

You'll need to flush out the logic for that screen first to determine when and if you want that value to be included.

Considerations like : If the form will be used for View as well as Edit (exisitng records), then you'll need to account for using the previous form value or the stored value.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,932)