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

Submitting new record to SQL Server with GUID

Hi,

 

I am trying to submit a new record into SQL server which required a GUID. function. I tried inserting a default value in the datacard with the value GUID() but I receive an error that the AccountID is required.

 

I tried the following Patch function but keep receiving the following errors (Unexpected characters: Contain 'ParenClose' where Error is expected):

 

Patch(
'[dbo].[Account]', Defaults('[dbo].[Account]'),
{
Name: DataCardValue20_2.text,
Surname: DataCardValue38_2.text,
Group: DataCardValue4_2.text,
Passport No: DataCardValue36_2.text,
Tel No: DataCardValue39_2.text,
Cell No: DataCardValue2_2.text,
ID No: DataCardValue5_2.text,
Nationality: DataCardValue21_2.text,
Relationship: DataCardValue37_2.text,
Email Address: DataCardValue3_2.text,
Initials: DataCardValue19_2.text,
Notes: DataCardValue35_2.text,
AccountID: GUID()
}
)

 

What could be the problem with the above Patch statement? Is there any other way to submit a new record with GUID?

 

Thanks in advance.

1 REPLY 1
Super User III
Super User III

Hi @wschel 

Part of the problem is that for column names with spaces, you need to enclose the column names in single quotes. The column names are also  case sensitive, so the names you provide will need to match the case of your source columns.

The following should hopefully take you further.

Patch(
      '[dbo].[Account]', 
      Defaults('[dbo].[Account]'),
      {
         Name: DataCardValue20_2.Text,
         Surname: DataCardValue38_2.Text,
         Group: DataCardValue4_2.Text,
         Passport No: DataCardValue36_2.Text,
         'Tel No': DataCardValue39_2.Text,
         'Cell No': DataCardValue2_2.Text,
         'ID No': DataCardValue5_2.Text,
         Nationality: DataCardValue21_2.Text,
         Relationship: DataCardValue37_2.Text,
         'Email Address': DataCardValue3_2.Text,
         Initials: DataCardValue19_2.Text,
         Notes: DataCardValue35_2.Text,
         AccountID: GUID()
       }
)

 

 

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,658)