VB Expression Samples
VB Expression (What you should paste in expr Editor)
List of String New List(Of String) From {"Value1", "Value2", "Value3"}
Array of String {"v1", "v2", "v3"}
List of T New List(Of Customer) From {
New Customer("1", "Baishali"),
New Customer("2", "Viswa"),
New Customer("3", "Evan") }
Initialize an object with object initializer New Customer With {.Name = "Terry Adams"}
New Customer With {.Name = "Jeff Poe", .City = "Montana"}
Access the nth value of a 1D List Data <PageName>.<ControlName>.DataSource(index).Value
Eg:-
[Link](0).Value
Get Value at Index T <ListName>(0).<PropertyName>
Eg:- [Link](0).CustomerName where entityList is an
AppVariable which holds a list of entities.
String “hello” (any string in quotes)
Int 45 (any integer value without quotes)
DateTime New [Link](1993, 5, 31, 12, 14, 0)
Boolean true / false
Toggle a Boolean Value X = Not X where X is a boolean
Guid [Link]()
Decimal 0.5, [Link](1.1), 328.558D
List Control Examples
Populate the Datasource of any single list
control / multiselect with list of primitives
New ListSource(Of String) With {.data =
new List(of string) from {"a", "b", "c"}}
Populate ListSource with entity list or use it to
set dropdown/radio default selected value
New ListSource(Of Customer) With {.data =
New List(Of Customer) From {
New Customer("1", "Baishali"),
New Customer("2", "Viswa"),
New Customer("3", "Evan") }}
Testing 2D Data returned by a complex Object
UseCase
Create a 2D variable of type EntityExample Give it a name like entityList
Set value of variable entityList
Set a button text property to an app variable [Link](0).CustomerName
Testing with Entity Functions
Scenarios
Simple Fetch Function Fetch(of AlexEntity)()
Fetch Function with
Filter Condition
Fetch(of AlexEntity)(createFilterGroup(new
QueryFilter(){addFilter("Name", "=", "Halo2")}), new
PaginationProps(0, 10))
Fetch fx with Filter
Condition and Sort
Order (ascending) Fetch(of AlexEntity)(createFilterGroup(new
QueryFilter(){addFilter("Name", "=", "Halo2")}), new
PaginationProps(0, 10), new SortOption(){addSortOption
("Date")})
Fetch fx with Filter
Condition and Sort
Order (descending) Fetch(of AlexEntity)(createFilterGroup(new
QueryFilter(){addFilter("Name", "=", "Halo2")}), new
PaginationProps(0, 10), new SortOption(){addSortOption
("Date", true)})
Fetch fx with Static
Pagination Props
Fetch(of AlexEntity)(Nothing, new PaginationProps(0,
100))
Fetch fx with Control
Bound Pagination Props
(Eg:- EG) Fetch(of AlexEntity)(Nothing, new PaginationProps
([Link], MainPage.
[Link]))
Fetch fx with Projection
Fetch(of AlexEntity)(createFilterGroup(new
QueryFilter(){addFilter("Name", "=", "Halo2")}), new
PaginationProps(0, 10), Nothing, new string(){"Name"})
Fetch fx with Control
properties for
Pagination, sort, filter Fetch(of PerfTest10kRecs)(
(Eg: EG)
If([Link]<1,
Nothing,
createFilterGroup(new QueryFilter(){addFilter(
[Link],"contains",
[Link])})
),
new PaginationProps([Link],
[Link]),
If([Link]<1,
Nothing,
new SortOption(){addSortOption(
[Link],MainPage.
[Link])}
)
)
LINQ Operators Usage
Filter a List of strings
[Link](Function(s) s = "term").First()
Use Values of Multiselect
to insert into a choiceset
/ Project custom example [Link].
Select(Function(x) [Link]).ToList()
Check if a nullable [Link](Function(x) [Link]([Link],
boolean field is true/false True)).ToList()
Print the output of a multi 1. Assign the output of the choiceset to a AppsDataSource of Choiceset
valued choiceset 2. Then lookup NumberId's display name in that
3. Print as a joined string
[Link]("," ,[Link](Function(x) [Link]
(Function(CSItem) [Link] = [Link]).DisplayName))
Set default selected value [Link](Function(x) [Link] = new GUID
of a control. ("33EF35AB-D18C-ED11-9D78-000D3A595FD3")).ToList(0)
Usage of DataTable
How to bind DataTable to complex control
[Link]([Link]())
How to access a specific cell value in a DataRow
[Link](0).Item("Name").ToString
How to use in RHS of set value
BuildDataTable(
New DataTable("TestDT"),
New DataColumn(){ New DataColumn("Name"), New DataColumn("Age")},
New List(Of Object) From {
AddDataRow(New Object(){"Baishali", "30"}),
AddDataRow(New Object(){"Viswa", "33"})
},
True
)