cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

Add "PowerApps Language" to "Insert/Edit code sample" in PowerApps forums

Hello.

Please be so kind as to read my full post before responding.
Thank you for your consideration.
I am not quite sure where to put this, so I am posting it as a PowerApps Idea.

For forum posts, there's an Insert/Edit code sample function to show formulas from PowerApps with Syntax highlighting.
But there is no language option for actual PowerApps formulas.
The JavaScript option seems to be the first and closest match to the actual PowerApps highlighting that I could find.
However, there seems to be no option at all that properly highlights PowerApps formulas with all its idiosyncrasies, for example

  1. In PowerApps formulas literal strings "some string" are different from names of Data Sources, Option Sets, Fields 'Accounts' etc.
  2.  PowerApps highlights Collections, DataSources, Variables etc with color
  3.  JavaScript and PowerApps objects and lists have a slightly different syntax, in particular the field names don't need quotes
  4. "PowerApps highlights the disambiguation with [@] ...

Here's a screenshot of a sample formula from PowerApps:
image.png
And here's an attempt to show the same formula inside this post
image.pngimage.png

JavaScript (looks the same same as the php/java/c/c#/c++ options for this example)

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 

html/xml (first option and quite useless default!)

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 

css:

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 

 php:

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 

ruby:

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 

python:

 

ClearCollect(LocalContacts, [@'Kontakte']);
ClearCollect(LocalContactStatus, Choices('Status (Kontakte)'));
Set(globalVariable, 'Status (Kontakte)'.Aktiv);
UpdateContext({
    localVariable: 'Status (Kontakte)'.Inaktiv
});
Set(test, globalVariable=localVariable);
ClearCollect(LocalCollection, [
    { number: 0, string: "0"},
    { number: 1, string: "1"}
])

 


Please add a syntax highlighting option for actual PowerApps formulas to be used in this PowerApps forum.

Thank you,
    Sa.

Status: New