cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TesDA
Responsive Resident
Responsive Resident

Patch to Azure SQL Server

I've used patch before to write to SQL Server, so I know it works.

 

I have the following patch which isn't giving me an error, but its not updating the source. This is a Checkmark icon, OnSelect:

ID_SubOnboarding is the table key

 

Patch('[dbo].[App_SubOnboarding]',
	First(Filter('[dbo].[App_SubOnboarding]',IDSubcon_Label.Text = Text(ID_SubOnboarding))),
	{SubconApprover:"US"&Office365Users.MyProfile().MailNickname, 
	SubconApproverDate:Now(), 
	SubconApproval:"Approved",
	SubcontractNum:SubconNum_TextInput.Text,
	SubcontracsAdmin:LookUp('[dbo].[vps_App_SubOnboarding_Emp]', USID = SubconAdmin_DropDown.SelectedText.USID).USID,
	VendorNumber:VenNum_TextInput.Text, 
	SubContractsMgrEmail:SubEmail_TextInput.Text,
	SubName:SubName_TextInput.Text} )

 

Let me know if there is anything else that could be helpful to solve this. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
TesDA
Responsive Resident
Responsive Resident

It works! In sql I think the issue is that I was using my pk key column which was throwing things off for some reason. I created a new calculated column, which basically just mimics the pk column. I also had to close down the app and restart it.

View solution in original post

3 REPLIES 3
poweractivate
Super User II
Super User II

@TesDA 

 

Try this simple steps first see if it works:

 

1) Make sure this part is not returning just a Blank value i.e. make sure there is exactly one match for:

 

 

First(Filter('[dbo].[App_SubOnboarding]',IDSubcon_Label.Text = Text(ID_SubOnboarding)))

 

 

You can sometimes verify this by just selecting the following part of the formula in Power Apps Studio to make sure there is at least one match here in the returned Table:

 

 

Filter('[dbo].[App_SubOnboarding]',IDSubcon_Label.Text = Text(ID_SubOnboarding))

 

 

 

If the Filter part of the formula above does indeed return as empty, there is probably something wrong with it that only can be discovered in the specific context of your app, such as something with ID_SubOnboarding, with the Label Text, or with something else, so then check each part of it carefully if that is the case.

 

2)  For the second part of the formula with the change record, only use this one change record column as a test:

 

 

{SubconApproverDate:Now()}

 

 

 and for the moment for testing, just do not use the other columns.

 

3) if #2 was the one that worked, build back in slowly the other columns into the change record, to isolate the issue in case one of those change columns was the issue, gradually building it one-by-one with just one change column at a time.

 

In case none of above work, we would have to check it more closely. In the meantime, someone else can feel free to chime in for any possible more specific solution to this.

TesDA
Responsive Resident
Responsive Resident

@poweractivate 

 

I believe the issue is with

 

First(Filter('[dbo].[App_SubOnboarding]',IDSubcon_Label.Text = Text(ID_SubOnboarding)))

 Based on your above post. When I select this function, its telling me there is no data, "We didn't find any data."

 

This is strange because the gallery is based on the same table in the patch function: '[dbo].[App_SubOnboarding]' - since this is a dev database, there isn't alot there so its easy to do a quick comparison and visually see that they're the same.

 

I suspect this has something to do with ID_SubOnboarding which is set up as:

[ID_SubOnboarding] [int] IDENTITY(1,1) NOT NULL

 

 

TesDA
Responsive Resident
Responsive Resident

It works! In sql I think the issue is that I was using my pk key column which was throwing things off for some reason. I created a new calculated column, which basically just mimics the pk column. I also had to close down the app and restart it.

View solution in original post

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 (903)