cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Attempting to Patch SQL server table

 
 
 
 

I'm trying to load the results of a screen into my SQL server table.

 

PowerApps gives an error on VisitDate "Unexpected characters. The formula contains 'CurlyClose' where 'VisitDate' is expected"

 

What did I do wrong?

Thanks

 

 

 

 

 

	  Patch('[checklist].[StoreVisit]', Defaults('[checklist].[StoreVisit]'),
	{
      [VisitDate]: vThisVisitDate
      ,[ChannelManagerEmail]: vCurrentUser.Email
      ,[ChannelManagerName]: vCurrentUser.FullName
      ,[StoreId]: vThisStoreID
      ,[StoreName]: vThisStoreName	  
      ,[IsPurposeStoreTrain]: if(chbox_Sec1_StoreTrain.Value,1,0)
      ,[IsPurposeSBE1on1]: if(chbox_Sec1_SBE_1on1.Value,1,0)
      ,[IsPurposeColdCallingBlitz]: if(chbox_Sec1_ColdCallBlitz.Value,1,0)
      ,[IsPurposeNewHireTrain]: if(chbox_Sec1_NewHire.Value,1,0)
      ,[IsPurposeManagerMeeting]: if(chbox_Sec1_ManagerMeeting.Value,1,0)
      ,[IsPurposeSidebySideSelling]: if(chbox_Sec1_SidebySide.Value,1,0)
      ,[IsPurposeBusinessHostedEvent]: if(chbox_Sec1_Businesshosted.Value,1,0)
      ,[IsPurposeDoortoDoorProspecting]: if(chbox_Sec1_DoortoDoor.Value,1,0)
      ,[IsPurposeNewCustomer]: if(chbox_Sec1_NewCustomer.Value,1,0)
      ,[IsMetwithSBE]: if(chbox_Sec2_SBE.Value,1,0)
      ,[IsMetwithStoreManager]: if(chbox_Sec2_StoreManager.Value,1,0)
      ,[IsMetwithAssistantSM]: if(chbox_Sec2_AssistantSM.Value,1,0)
      ,[IsMetwithRetailConsultant]: if(chbox_Sec2_RetailConsultant.Value,1,0)
      ,[IsMetwithAllStoreStaff]: if(chbox_Sec2_AllStoreStaff.Value,1,0)
      ,[IsAskingCLQuestions]: if(Tog2_Sec4_CLspecificquestion.Value,1,0)
      ,[IsSBEArticulate]: if(Tog3_Sec4_SBEArticulate.Value,1,0)
      ,[IsStoreDemonstrate]: if(Tog1_Sec5_demonstrateproperBiz.Value,1,0)
      ,[IsActiveSalesFunnel]: if(Tog3_Sec4_SalesFunnel.Value,1,0)
      ,[IsProposeNewActionPlan]: if(Tog1_Sec6_ProposeActPlan.Value,1,0)
      ,[ActionPlan]: if(txt_sec6_ActionPlan.Text,1,0)
      ,[VisitNotes]: if(txt_sec8_VisitNotebox.Text,1,0)
      ,[IsEmailSM]: if(chbx_EmailSM.Value,1,0)
      ,[IsEmailRCM]: if(chbx_EmailRCM.Value,1,0)
      ,[IsEmailDM]: if(chbx_EmailDM.Value,1,0)
      ,[IsEmailISM]: if(chbx_EmailISM.Value,1,0)
      ,[IsEmailIAE]: if(chbx_EmailIAE.Value,1,0)
     // ,[EmailSentDatetime]: if(XXCONTROLXX.Value,1,0)
      ,[IsExecuteLastActionPlan]: if(Tog1_Sec4_execLastACplan.Value,1,0)
	}
);	 





// Reset all controls
Set(vReset,true); Set(vReset,false); Navigate('4_Success')

 

 

 

 

 

 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Attempting to Patch SQL server table

Hi @Sjj9166 

It could be because your field names are surrounded by square brackets.

If you try this, does that take you any further?

  Patch('[checklist].[StoreVisit]', Defaults('[checklist].[StoreVisit]'),
	{
       VisitDate: vThisVisitDate
      ,ChannelManagerEmail: vCurrentUser.Email
      ,ChannelManagerName: vCurrentUser.FullName
      ,StoreId: vThisStoreID
      ,StoreName: vThisStoreName	  
      ,IsPurposeStoreTrain: if(chbox_Sec1_StoreTrain.Value,1,0)
      ,IsPurposeSBE1on1: if(chbox_Sec1_SBE_1on1.Value,1,0)
      ,IsPurposeColdCallingBlitz: if(chbox_Sec1_ColdCallBlitz.Value,1,0)
      ,IsPurposeNewHireTrain: if(chbox_Sec1_NewHire.Value,1,0)
      ,IsPurposeManagerMeeting: if(chbox_Sec1_ManagerMeeting.Value,1,0)
      ,IsPurposeSidebySideSelling: if(chbox_Sec1_SidebySide.Value,1,0)
      ,IsPurposeBusinessHostedEvent: if(chbox_Sec1_Businesshosted.Value,1,0)
      ,IsPurposeDoortoDoorProspecting: if(chbox_Sec1_DoortoDoor.Value,1,0)
      ,IsPurposeNewCustomer: if(chbox_Sec1_NewCustomer.Value,1,0)
      ,IsMetwithSBE: if(chbox_Sec2_SBE.Value,1,0)
      ,IsMetwithStoreManager: if(chbox_Sec2_StoreManager.Value,1,0)
      ,IsMetwithAssistantSM: if(chbox_Sec2_AssistantSM.Value,1,0)
      ,IsMetwithRetailConsultant: if(chbox_Sec2_RetailConsultant.Value,1,0)
      ,IsMetwithAllStoreStaff: if(chbox_Sec2_AllStoreStaff.Value,1,0)
      ,IsAskingCLQuestions: if(Tog2_Sec4_CLspecificquestion.Value,1,0)
      ,IsSBEArticulate: if(Tog3_Sec4_SBEArticulate.Value,1,0)
      ,IsStoreDemonstrate: if(Tog1_Sec5_demonstrateproperBiz.Value,1,0)
      ,IsActiveSalesFunnel: if(Tog3_Sec4_SalesFunnel.Value,1,0)
      ,IsProposeNewActionPlan: if(Tog1_Sec6_ProposeActPlan.Value,1,0)
      ,ActionPlan: if(txt_sec6_ActionPlan.Text,1,0)
      ,VisitNotes: if(txt_sec8_VisitNotebox.Text,1,0)
      ,IsEmailSM: if(chbx_EmailSM.Value,1,0)
      ,IsEmailRCM: if(chbx_EmailRCM.Value,1,0)
      ,IsEmailDM: if(chbx_EmailDM.Value,1,0)
      ,IsEmailISM: if(chbx_EmailISM.Value,1,0)
      ,IsEmailIAE: if(chbx_EmailIAE.Value,1,0)
      ,IsExecuteLastActionPlan: if(Tog1_Sec4_execLastACplan.Value,1,0)
	}
);	 

// Reset all controls
Set(vReset,true); Set(vReset,false); Navigate('4_Success')

 

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Attempting to Patch SQL server table

Hi @Sjj9166 

It could be because your field names are surrounded by square brackets.

If you try this, does that take you any further?

  Patch('[checklist].[StoreVisit]', Defaults('[checklist].[StoreVisit]'),
	{
       VisitDate: vThisVisitDate
      ,ChannelManagerEmail: vCurrentUser.Email
      ,ChannelManagerName: vCurrentUser.FullName
      ,StoreId: vThisStoreID
      ,StoreName: vThisStoreName	  
      ,IsPurposeStoreTrain: if(chbox_Sec1_StoreTrain.Value,1,0)
      ,IsPurposeSBE1on1: if(chbox_Sec1_SBE_1on1.Value,1,0)
      ,IsPurposeColdCallingBlitz: if(chbox_Sec1_ColdCallBlitz.Value,1,0)
      ,IsPurposeNewHireTrain: if(chbox_Sec1_NewHire.Value,1,0)
      ,IsPurposeManagerMeeting: if(chbox_Sec1_ManagerMeeting.Value,1,0)
      ,IsPurposeSidebySideSelling: if(chbox_Sec1_SidebySide.Value,1,0)
      ,IsPurposeBusinessHostedEvent: if(chbox_Sec1_Businesshosted.Value,1,0)
      ,IsPurposeDoortoDoorProspecting: if(chbox_Sec1_DoortoDoor.Value,1,0)
      ,IsPurposeNewCustomer: if(chbox_Sec1_NewCustomer.Value,1,0)
      ,IsMetwithSBE: if(chbox_Sec2_SBE.Value,1,0)
      ,IsMetwithStoreManager: if(chbox_Sec2_StoreManager.Value,1,0)
      ,IsMetwithAssistantSM: if(chbox_Sec2_AssistantSM.Value,1,0)
      ,IsMetwithRetailConsultant: if(chbox_Sec2_RetailConsultant.Value,1,0)
      ,IsMetwithAllStoreStaff: if(chbox_Sec2_AllStoreStaff.Value,1,0)
      ,IsAskingCLQuestions: if(Tog2_Sec4_CLspecificquestion.Value,1,0)
      ,IsSBEArticulate: if(Tog3_Sec4_SBEArticulate.Value,1,0)
      ,IsStoreDemonstrate: if(Tog1_Sec5_demonstrateproperBiz.Value,1,0)
      ,IsActiveSalesFunnel: if(Tog3_Sec4_SalesFunnel.Value,1,0)
      ,IsProposeNewActionPlan: if(Tog1_Sec6_ProposeActPlan.Value,1,0)
      ,ActionPlan: if(txt_sec6_ActionPlan.Text,1,0)
      ,VisitNotes: if(txt_sec8_VisitNotebox.Text,1,0)
      ,IsEmailSM: if(chbx_EmailSM.Value,1,0)
      ,IsEmailRCM: if(chbx_EmailRCM.Value,1,0)
      ,IsEmailDM: if(chbx_EmailDM.Value,1,0)
      ,IsEmailISM: if(chbx_EmailISM.Value,1,0)
      ,IsEmailIAE: if(chbx_EmailIAE.Value,1,0)
      ,IsExecuteLastActionPlan: if(Tog1_Sec4_execLastACplan.Value,1,0)
	}
);	 

// Reset all controls
Set(vReset,true); Set(vReset,false); Navigate('4_Success')

 

View solution in original post

Highlighted
Community Support
Community Support

Re: Attempting to Patch SQL server table

Hi @Sjj9166 ,

Based on the formula you provided, I think there is something wrong with it. Within the '{}' part of Patch formula, you should not wrap the column name with '[]' (Square brackets), please remove the '[]' from these specified column names within your Patch formula, then check if the issue fixed.

Patch(
        '[checklist].[StoreVisit]', 
         Defaults('[checklist].[StoreVisit]'),
	{
         VisitDate: vThisVisitDate,
         ChannelManagerEmail: vCurrentUser.Email,
         ChannelManagerName: vCurrentUser.FullName,
         StoreId: vThisStoreID,
         StoreName: vThisStoreName,	  
         ...
         ...
         IsEmailISM: if(chbx_EmailISM.Value,1,0),
         IsEmailIAE: if(chbx_EmailIAE.Value,1,0),
         IsExecuteLastActionPlan: if(Tog1_Sec4_execLastACplan.Value,1,0)
	}
);
// Reset all controls
Set(vReset,true); Set(vReset,false); Navigate('4_Success')

 

Please consider take a try with above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

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 (7,885)