wavemaker visual ajax studio 4.0 training basics: livevariables
TRANSCRIPT
WaveMaker Visual AJAX Studio 4.0 Training
Basics: LiveVariables
2
How it Works
● When you create a LiveVariable, you select a LiveView or LiveTable to base it on
● You must also select a database operation for the LiveVariable: Read, Insert, Update or Delete
● When you create a LiveForm or a DataGrid, you select a LiveVariable to use as the data set
3
Bind Components to Data Source
● LiveVariable forms the link between the data source and the LiveForm or DataGrid
LiveForm/ DataGridLiveVariableDatabase
4
Create a New LiveVariable
● On the Component Tree menu, click New LiveVariable icon
● Properties for the new LiveVariable now appear in the Property Editor
5
Name the New LiveVariable
● Type in a name for the name property in the Property Editor
● This is the name that appears in the Component Tree and in the Binding dialogs so make the name descriptive
– Studio gives the LiveVariable a default name, so this step is optional, but recommended
6
Choose a Data Source
● Select a data source from the drop-down menu for the liveSource property
● This list includes all the LiveTables and LiveViews defined in the project
7
LiveTables or LiveViews?
● When you create a LiveVariable, you must choose a LiveTable or a LiveView as the “source” for the data
● Choose a LiveView when:– You need to access fields from a related table or
– Your LiveTable has a composite primary key
● Otherwise, use a LiveTable
8
Choose a Data Operation
● Select a data operation from the drop-down menu for the operation property
● This list includes the following database operations:
– readData
– insertData
– updateData
– deleteData
9
Filter the Data (optional)
● You can filter the data in the specified by the liveSource:– specify a filter object– filter individual fields
● You can only set up filters when the LiveVariable operation is readData
● Filter can be bound to a widget, expression, or service variable
10
Filter the liveSource as a Whole
● Use the filter property in the Properties Tree
● Bind to an object of the same type as the LiveVariable
11
Filter individual Fields
● Select a filter object in the Properties Tree
● Individual fields appear in the Property Editor
12
Bind to the Field
● You can bind a filter to one or more fields
● Fields marked with an asterisk are complex structures – Bind the whole structure to an object
of the same type or– Expand the structure in the Properties
Tree and bind to individual fields
13
Other LiveVariable Properties
● autoUpdate: automatically refresh data from database
● ignoreCaseChoose: whether to make the results case sensitive or not
● updateNow: update the Service Variable (use in design mode)
● queue: defines a list of Service Variables to execute, in order, after this Variable executes
14
LiveVariable Properties for Lists
● firstRow: for setting up paging in conjunction with maxResults (ignored if maxResults is not set)
● maxResults: the number of records that will be returned at runtime
● designMaxResults: the number of records that will be returned when viewing data at design time.
● orderBy: specify a property to use for ordering the data (you can order in ascending or descending order)
15
sourceData Property
● Use of the sourceData property is an advanced topic. It is not needed in most cases.
16
Questions?
17
Exercises 8
● Add a Live Variable– Bind to DataGrid
– Filter based on Search Criteria