AppStudio - Expression Patterns

Haven’t seen this documented anywhere. feel free to markup and add examples, commentary, etc.

Expression Patterns

Pattern in String Example Parser Description
~_..._~ ~_MyComponent.Property_~ parseControlExpression Identifies control expressions wrapped with ~_ and _~
{...} {OrderHed.OrderNum} parseEpBinding Detects Epicor binding expressions enclosed in curly braces
% %session.UserName% parseToken Flags tokenized strings, possibly for templating or substitution
#_..._#,
.row%,
.count%,
.hasRow%,
.hasChanges%
#_new Date().getDate()_#
#_trans.dataView('OrderHed').row_#
%OrderHed.row%, %Customer.count%
parseJSExpression Identifies dynamic JavaScript expressions embedded in strings

Special Arguments

Placeholder Source Object Description
%value% dataColumnChangeEventArgs.value The new value in a data change event
%row% dataColumnChangeEventArgs.row The full row of data associated with the change
%oldValue% dataColumnChangeEventArgs.oldValue The previous value before the change
%current% dataColumnChangeEventArgs.current The current item or context
%previous% dataColumnChangeEventArgs.previous The previous item or context
%column% dataColumnChangeEventArgs.column The name of the column affected
%readOnly% dataColumnChangeEventArgs.readOnly Boolean indicating if the column is read-only
%currentDataView% transactionService.currentDataView() The current state of the data view
%previousDataView% transactionService.previousDataView() The prior state of the data view
%coreCurrentDataView% transactionService.coreCurrentDataView() The core (non-enhanced) current data view
%corePreviousDataView% transactionService.corePreviousDataView() The core prior data view
%nodeEntityType% p.node.entityType Entity type of the selected tree node (if event is tree-based)
%nodeSysRowID% p.node.sysRowID Unique row ID of the selected node
%nodeIsFolder% p.node.isFolder Indicates if the node is a folder (true/false)
%nodePath% p.node.nodePath Path of the selected node in the hierarchy
%dragEntityType% e.entityType Entity type being dragged (if drag-drop event)
%startDateTime% b.start Start time of the scheduler event
%endDateTime% b.end End time of the scheduler event
%isAllDayEvent% b.isAllDay Boolean flag for all-day scheduler events

This is AI-gen so mileage may vary.

Not sure why I can’t edit this topic. To clarify for my reference.

this token expression

%OrderHed.count%

evals to this js expression

#_trans.dataView('OrderHed').count_#

which evals to the count of rows in OrderHed dataview.

I wish this stuff was documented for us so that we didn’t have to do what you’re doing, but I appreciate it greatly.

There is a timer on how long you can edit your posts. :man_shrugging:

Sounds like a wiki…

Now he can edit it..

Working From Home Moderator GIF by autentity

3 Likes

Yes. And if the js app services weren’t so black-box there’d be no WHY we have to do what we’re doing.

I mean the transactionService is a treasure trove available only via one-liner js expressions. I’m thankful it’s there but why not the componentService, sharedService, etc, etc

The thing is a monster client-side but we got nadda power.

I mean why is my browser doing some plastic-tax logic (whatever that means) and processing file-picker content but I can’t call txtPicker.model.files[0].getBase64() or grab the processed content from cacheService?

Someday, fingers crossed. We’ll see.

Ps thanks all.

note to self: why does this work?

'{TransView.TextArea}'.replace(/\\n/g, "\r\n")

I wonder if it is possible to combine expressions such as:

#_trans.dataView('{sysVariable.dataviewName}').hasChanges_# or %sysVariable.dataview.hasChanges% as one liner.

I have tried both, first one works but the second one does not.

Yes the expression evaluator will try to handle combinations of but .row, .count, .hasChanges are a little odd in the eval and parsing. These should work:

trans.hasChanges('{TransView.dataViewName}')
#_trans.dataView('{TransView.dataViewName}').hasChanges_#

Where TransView.dataViewName field value is the name of a dataview like ‘Parts’.

Each of these pass through the evaluator twice. First to resolve the field value in the {epBinding} syntax. Second to execute the entire expression with those values in place.

So your first example should work if sysVariable is a dataview having a field dataviewName containing the name of a dataView in your App.