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

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
Resolver II
Resolver II

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
Resolver II
Resolver II

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

Highlighted
Helper I
Helper I

Re: Updating SQL record

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

Helpful resources

Announcements
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

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,257)