cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

What Brackets go where and when do I use them

Hi,

 

In access vba when you got a naming wrong (left space between words), or there was a invalid symbol used or the word was a control (part of the programming language) you placed it in brackets.

 

If I have "1.4_Comments"

and wish to use it in "1.4_Comments.Text"

Do I use square brackets or ....?

[1.4_Comments].Text

 

For Example because of the decimal point:

 

Patch(GeneralHSEAudit_Mobile, {[1.4_Comments]: EditScreen1.[1.4_Comments].text, [2.1_Plan]:EditScreen1.[2.1_Plan].Text........})

 

Both the "(" and The "{" are used in the programming syntex, what else is best practice?

Ta

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: What Brackets go where and when do I use them

Hi @Anonymous

Single quotes are what we usually use to escape column names. In your example, the code would look something like this.

Patch(GeneralHSEAudit_Mobile, 
      SourceRecordThatYouWantToPatch,
      {'1.4_Comments': EditScreen1.'1.4_Comments'.text, 
       '2.1_Plan':EditScreen1.'2.1_Plan'.Text........
} )

In terms of other best practice, I would recommend reading the best practice document here.

https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf

View solution in original post

Community Support Team
Community Support Team

Re: What Brackets go where and when do I use them

Hi @Anonymous,

Based on the formula that you mentioned, I think there is something wrong with it. The '[' and ']' symbol could not be used to decorate a field name within your data source in PowerApps currently.

I agree with @timl's thought almost. Currently, within PowerApps, the single quote is usually used to escape column names. If you have enabled/turned on the "Use column display names" functionality within Advanced settings of App settings of your app, you could reference the Display name of the columns of your data source within an app instead of logic names.

Please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/display-names-enters-preview-for-canvas-apps/

 

On your side, please modify your formula as below:

Patch(    /* <-- Add new record into your data source */
GeneralHSEAudit_Mobile,
Defaults(GeneralHSEAudit_Mobile),
{
'1.4_Comments': EditScreen1.'1.4_Comments'.text,
'2.1_Plan': EditScreen1.'2.1_Plan'.Text
...
}
)

Note: The '1.4_Comments', '2.1_Plan', ... represent the Text Input box controls in your app. The '1.4_Comments', '2.1_Plan', ... represents the columns in your data source.

Patch(    /* <-- Modify existing record within your data source */
GeneralHSEAudit_Mobile,
LookUp(GeneralHSEAudit_Mobile, PrimaryColumn = "XXXXXX"), /* <-- Find the existing record you want to update */
{
'1.4_Comments': EditScreen1.'1.4_Comments'.text,
'2.1_Plan': EditScreen1.'2.1_Plan'.Text
...
}
)

 

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.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: What Brackets go where and when do I use them

Hi @Anonymous

Single quotes are what we usually use to escape column names. In your example, the code would look something like this.

Patch(GeneralHSEAudit_Mobile, 
      SourceRecordThatYouWantToPatch,
      {'1.4_Comments': EditScreen1.'1.4_Comments'.text, 
       '2.1_Plan':EditScreen1.'2.1_Plan'.Text........
} )

In terms of other best practice, I would recommend reading the best practice document here.

https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf

View solution in original post

Community Support Team
Community Support Team

Re: What Brackets go where and when do I use them

Hi @Anonymous,

Based on the formula that you mentioned, I think there is something wrong with it. The '[' and ']' symbol could not be used to decorate a field name within your data source in PowerApps currently.

I agree with @timl's thought almost. Currently, within PowerApps, the single quote is usually used to escape column names. If you have enabled/turned on the "Use column display names" functionality within Advanced settings of App settings of your app, you could reference the Display name of the columns of your data source within an app instead of logic names.

Please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/display-names-enters-preview-for-canvas-apps/

 

On your side, please modify your formula as below:

Patch(    /* <-- Add new record into your data source */
GeneralHSEAudit_Mobile,
Defaults(GeneralHSEAudit_Mobile),
{
'1.4_Comments': EditScreen1.'1.4_Comments'.text,
'2.1_Plan': EditScreen1.'2.1_Plan'.Text
...
}
)

Note: The '1.4_Comments', '2.1_Plan', ... represent the Text Input box controls in your app. The '1.4_Comments', '2.1_Plan', ... represents the columns in your data source.

Patch(    /* <-- Modify existing record within your data source */
GeneralHSEAudit_Mobile,
LookUp(GeneralHSEAudit_Mobile, PrimaryColumn = "XXXXXX"), /* <-- Find the existing record you want to update */
{
'1.4_Comments': EditScreen1.'1.4_Comments'.text,
'2.1_Plan': EditScreen1.'2.1_Plan'.Text
...
}
)

 

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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,544)