cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Patch to 2 Dfferent Data Sources

Is it possible to Patch to two different SQL tables? For example:

 

 

Patch('[dbo].[Test]', Defaults('[dbo].[Test]'),'[dbo].[Test2]', Defaults('[dbo].[Test2]'), {Testdata: TextInput_1.Text, Testdata2: Option1.Selected.Value, Testdata3: Option2.Selected.Value}) 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mr-dang
Level 10

Re: Patch to 2 Dfferent Data Sources

Hi,

This is possible. Any time that you want to perform more than one action with a Button (or any object with the OnSelect property), use a semicolon to separate actions:

 

 

Patch('[dbo].[Test]', Defaults('[dbo].[Test]'),
	{Testdata: TextInput_1.Text, 
		Testdata2: Option1.Selected.Value, 
		Testdata3: Option2.Selected.Value
	}
);
Patch('[dbo].[Test2]', Defaults('[dbo].[Test2]'), {Testdata: TextInput_1.Text, Testdata2: Option1.Selected.Value, Testdata3: Option2.Selected.Value } )

 

This formula means, "Patch the data to [dbo].[Test], then patch the same data to [dbo].[Test2]." There's no limit to the number of actions you can chain.

Microsoft Employee
@8bitclassroom

View solution in original post

6 REPLIES 6
mr-dang
Level 10

Re: Patch to 2 Dfferent Data Sources

Hi,

This is possible. Any time that you want to perform more than one action with a Button (or any object with the OnSelect property), use a semicolon to separate actions:

 

 

Patch('[dbo].[Test]', Defaults('[dbo].[Test]'),
	{Testdata: TextInput_1.Text, 
		Testdata2: Option1.Selected.Value, 
		Testdata3: Option2.Selected.Value
	}
);
Patch('[dbo].[Test2]', Defaults('[dbo].[Test2]'), {Testdata: TextInput_1.Text, Testdata2: Option1.Selected.Value, Testdata3: Option2.Selected.Value } )

 

This formula means, "Patch the data to [dbo].[Test], then patch the same data to [dbo].[Test2]." There's no limit to the number of actions you can chain.

Microsoft Employee
@8bitclassroom

View solution in original post

Re: Patch to 2 Dfferent Data Sources

Thank you! I'll give that a try this morning.

Re: Patch to 2 Dfferent Data Sources

That worked! Now comes the fun part of writing a formula that writes to 8 different tables. Thanks again @mr-dang

BraneyBI
Level: Powered On

Re: Patch to 2 Dfferent Data Sources

Mr-dang,

Truly appreciate all of your posts!  They seem to always be here just when I need them!

Smiley Very Happy

tianaranjo
Level 8

Re: Patch to 2 Dfferent Data Sources

I posted in another thread, but after coming across this thread, wanted to pose my question here also.  The data for my app is a SharePoint list.  I have a choice column with 1. Report an Issue 2. Make a Suggestion 3. Ask a Question.  If the user selects 1 or 2, I would like the new item to go to the original data source.  However, if they select 3, I would like to patch the data to a SharePoint discussion board.  

First, is this possible?

Second, if so, how would I write the formula to patch to the DB?

 

Thank you.

 

Highlighted
BraneyBI
Level: Powered On

Re: Patch to 2 Dfferent Data Sources

You are going to want to wrap the patch in an IF statement to check for your selection.  In this case, if 1 or 2 is selected, then the first patch will run, else the second.  Note:  There is now a Comma between the patches (not a semicolon) as it is now separating the clauses of the IF statement. 

 

If( 
(MyChoice.Selected.Value = 1 or MyChoice.Selected.Value = 3)

Patch('[dbo].[Test]', Defaults('[dbo].[Test]'),
	{Testdata: TextInput_1.Text, 
		Testdata2: Option1.Selected.Value, 
		Testdata3: Option2.Selected.Value
	}
),

Patch('[dbo].[Test2]', Defaults('[dbo].[Test2]'), 
	{Testdata: TextInput_1.Text, 
		Testdata2: Option1.Selected.Value, 
		Testdata3: Option2.Selected.Value
	}
)
)

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,005)