REFERRING USER PROFILE ATTRIBUTES IN A FORM
While creating users accounts in User Management connector, some profile related information is stored in the system. Below we have illustrated how you can consume this information in the form.
To show Display Name in a form: Expression: Login.DisplayName To show email address in a form: Expression: Login.Email To show login ID in a form: Expression: Login.LoginID To show Department in a form: Expression: Login.Department |
GENERATING A UNIQUE ID OFFLINE
Many times we need to assign a unique identity to a form being submitted through makeen transform. Since makeen transform can work in offline mode as well, and generating a unique identity which remains unique for all records submitted by all users can turn out to be a tricky job. We recommend following expressions to meet this requirement:
Login.LoginID+"_"+Now().Day+""+Now().Month+""+Now().Year+""+Now().Hour+""+Now().Minute+""+Now().Second |
This expression would generate a sequence number similar to this:
michael.edward_10122019124823
TO FIND TEXT IN MULTI SELECT SEGMENTED CONTROL OUTPUT
Segmented control is among the key controls that shape great user experience in transform apps. While working with a multi-select segmented control you may need to configure some rules based on the selection a user would make through a segmented control.
Below expression helps you find a given text against the selection outcome of a segmented control.
Contains(Controls["segDepartments"].SelectedValues, "Logistics") |
USING MULTI SELECT SEGMENTED CONTROL AS RECIPIENTS LIST
At the time of submitting a form, you may want to present a list of recipients to the user to who the email notification shall be sent to. This list can be easily created using a segmented control.
Following expression can be used to extract semicolon separated email addresses from the segmented control output.
Concat(";",Controls["segEmailCopyTo"].SelectedValues) |
CALCULATING DIFFERENCE BETWEEN DATE & TIME
In order to record duration of an activity, usually start and end time are recorded in the app, and the difference between two points in time is calculated. It is depicted in the snapshot below:
Following expression can help you calculate the interval in the above scenario.
Math_Round((ToDate(Controls["dpActivityEndDate"].Date.ToString().Split(" ")[0]+" "+Controls["tpActivityEndTime"].Time.ToString())-ToDate(Controls["dpActivityStartDate"].Date.ToString().Split(" ")[0]+" "+Controls["tpActivityStartTime"].Time.ToString())).TotalMinutes, 0) |
SORTING RECORDS IN A REPEATER CONTROL
In makeen transform Repeater control is a multipurpose UI element that is used in many ways. One of the major uses is to list records on a page from a database. You can apply various types of sorting on the records listed under a repeater control. Here we have mentioned an example where records are sorted in reverse chronological order with respect to time stamp..
Entity["notes"].FindAll((["ComponentID"]+"")=Controls["ComponentID"].Text & (["ProjectID"]+"")=Controls["ProjectID"].Text).OrderBy(["TimeStamp"] desc) |
STORING DEVICE ID WITH FORM
In order to keep complete track of a record, sometimes it is required to store device unique identity along with the forms data submitted through that device. This can be achieved through following expression.
Device.DeviceID |
RECORDING FORM VERSION FOR AUDIT CONTROL
For version is an important piece of information especially for troubleshooting purposes. Here is how you can capture form verison.
PageDO.Version |
RECORDING FORM NAME
Likewise you can record Form Name along with the rest of the data.
PageDO.PageTitle |
RECORDING APP NAME
If needed, app name can also be recorded through this expression.
PageDO.PageTitle |
FUNCTIONS
Below you can find a detailed list of functions that you can apply while writing an expression.
GENERAL PURPOSE FUNCTION
Find
FindAll
Limit
Exists
GroupBy
GroupByNamed
Select
SelectNamed
OrderBy
Switch
IsDate
IsToday
AddPeriod
ToUtc
ToLocalTime
Percent
Bool
Join
FullJoin
InnerJoin
LeftJoin
RightJoin
ToList
ToDictionary
ToDate
Coalesce
ToObject
ToObjectList
Now
UtcNow
Substring
Replace
Split
ToUpper
ToLower
ToNumber
ToString
Format
Concat
ConcatNonEmpty
Contains
RegexReplace
RegexpReplace
Matches
MATH FUNCTIONS
Math_Abs
Math_Acos
Math_Asin
Math_Atan
Math_Atan2
Math_Cos
Math_Cosh
Math_Exp
Math_Log
Math_Max
Math_Min
Math_Pow
Math_Round
Math_Sin
Math_Sinh
Math_Sqrt
Math_Sum
Math_Tan
Math_Tanh
Math_Pi
Eval
TIME FUNCTIONS
AddPeriod(1, 'day')
AddPeriod(1, 'days')
AddPeriod(1, 'hour')
AddPeriod(1, 'hours')
AddPeriod(1, 'ms')
AddPeriod(1, 'millis')
AddPeriod(1, 'millisecond')
AddPeriod(1, 'milliseconds')
AddPeriod(1, 'min')
AddPeriod(1, 'mins')
AddPeriod(1, 'minute')
AddPeriod(1, 'minutes')
AddPeriod(1, 'month')
AddPeriod(1, 'months')
AddPeriod(1, 'sec')
AddPeriod(1, 'secs')
AddPeriod(1, 'second')
AddPeriod(1, 'seconds')
AddPeriod(1, 'tick')
AddPeriod(1, 'ticks')
AddPeriod(1, 'year')
AddPeriod(1, 'years')
AddPeriod(1, 'week')
AddPeriod(1, 'weeks')