cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Resolver II
Resolver II

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

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

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (14,986)