cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GraemeMitchell
Level: Powered On

Updating SQL record

On my first screen I choose a button (1-5), this will pass in the Part Count value depending on what button is clicked.  When I check the variables I can see that is correct.  When I click the "Update" button which is tied to the code below it doesn't update my SQL database;

 

UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,
Switch(
PartCount,
1,
{WIPCount1: (TextInput1_3.Text + DataCardValue4_1)},
2,
{WIPCount2: (TextInput1_3.Text + DataCardValue4_1)},
3,
{WIPCount3: (TextInput1_3.Text + DataCardValue4_1)},
4,
{WIPCount4: (TextInput1_3.Text + DataCardValue4_1)},
5,
{WIPCount5: (TextInput1_3.Text + DataCardValue4_1)}
)
);
UpdateContext({visible: true})

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
datamaster
Level 8

Re: Updating SQL record

Try switching it up with something like this:

Switch(
PartCount,
1,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount1: (TextInput1_3.Text + DataCardValue4_1)}),
2,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount2: (TextInput1_3.Text + DataCardValue4_1)}),
3,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount3: (TextInput1_3.Text + DataCardValue4_1)}),
4,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount4: (TextInput1_3.Text + DataCardValue4_1)}),
5,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount5: (TextInput1_3.Text + DataCardValue4_1)})
);
UpdateContext({visible: true})

 

------------------------------------------------------------------------------OfficePowerUser.com------------------------------------------------------------------------ 
If this post helps answer your question, please click on “Accept as Solution” to help other members. If you thought this post was helpful, please give it a Thumbs Up. 

View solution in original post

2 REPLIES 2
Highlighted
datamaster
Level 8

Re: Updating SQL record

Try switching it up with something like this:

Switch(
PartCount,
1,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount1: (TextInput1_3.Text + DataCardValue4_1)}),
2,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount2: (TextInput1_3.Text + DataCardValue4_1)}),
3,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount3: (TextInput1_3.Text + DataCardValue4_1)}),
4,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount4: (TextInput1_3.Text + DataCardValue4_1)}),
5,
UpdateIf(
'[dbo].[TCIEYREndPrt]',
ProductNumber = BrowseGallery1_3.Selected.ProductNumber,{WIPCount5: (TextInput1_3.Text + DataCardValue4_1)})
);
UpdateContext({visible: true})

 

------------------------------------------------------------------------------OfficePowerUser.com------------------------------------------------------------------------ 
If this post helps answer your question, please click on “Accept as Solution” to help other members. If you thought this post was helpful, please give it a Thumbs Up. 

View solution in original post

GraemeMitchell
Level: Powered On

Re: Updating SQL record

Thank you for the help, I would have never thought of Switch like that.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,061)