cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GraemeMitchell
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
datamaster
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
datamaster
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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,467)