, ,

The ListAndForm control

The ListAndForm control is suitable for implementing interactive Master-Detail views inside a PowerForm, as it helps you to create a fully functional subform inside a form. It contains 2 controls, a list query datagrid and a subform enriched with New/Edit/Delete buttons.

First of all a list query should be created at the Parent List. If you want to connect the query with an existing control, you should fill in the Criteria field during the List query creation. eg Title;{c_Title};Equals;Text

IMPORTANT: In order for the control to work as expected, you will have to include the ID column in your list query.

Then we add the ListAndForm control and we assign the list query to it. Now a datagrid is populated with the data provided by the list query and  a new subform is opened that gets detailed data from each row of the datagrid.

This new subform is just a form in the Parent form. It has its own designer, buttons, options etc. as all PowerForms. It is fully customizable. You can hide some controls, disable others, hide buttons(New, Save, Delete).

If you want to keep these customizations only for the subform, you should fill in a new condition in the Options>General Settings>Condition field that looks like ParentList() = “Parent List Name”. Now the saved customizations for the subform will load only if this form is contained in the specified parent form.

You can also connect the form controls with some fields in the subform by providing default values to these fields using the Extra configuration. 

When a new record is created in the subform, the default value of the Title field will be inherited by the value of the Title control of the parent form.

 

There are also some other choices you can set in the subform’s extra configuration :

Showfilter=True
A Combobox appears above the datagrid which helps you to filter the data.

Filters=Title;ID
It contains the fields that are used in the filter combobox

GridHeight=100
The height of the list Datagrid.

ShowGrid (True/False)
Determines if the grid will be visible or not.

AutoSelectFirst (True/False)
If set to True, the first record will be selected after data load.

, ,

The ActionButton control

In order to apply custom actions through user input, the ActionButton control can be used.

The ActionButton control acts as a normal button, and can be configured to execute multiple actions.

It can be rendered as a normal Silverlight Button, as a Hyperlink, as a Label or as an ImageButton.

Here are some examples:

 

The ActionButton supports the following action types :

SetValue

Sets a value to a control. ControlName and Value parameters must be specified.

JavascriptCommand

Only the value parameter is required. Any valid javascript typed in the Value property will be executed by the ActionButton control.

Script

Only the value parameter is required. Any IronPython script should be typed in the value property.

Extra Parameter Configuration

 

Examples

Set Value Action

Type : SetValue

ControlName : c_Title

Value : New Record

JavascriptCommand action

Type : JavascriptCommand

ControlName :

Value :

Code
window.open(‘http://www.bpc-components.com’,”,’width=600, height=400, resizable=yes, scrollbars=yes’)

Script Action

Type : Script

ControlName :

Value :

Code

template.GetControl(“c_Title”).SetValue(“New Record”)

template.SaveAndExit()

, ,

Taking advantage of the ListDataGrid ValueChange event

The ListDataGrid control is very useful for presenting data coming from other/related lists.

Apart from displaying the results, the control does not provide a value to be used from other controls or formula expressions.

The control however raises the ValueChange event and can be used from python script during run-time.

The ListDataGrid control, has a special method called GetGridItemValue(string) which can be used from script to get the attribute of the selected row in the grid.

In order to use the method, users should apply some code in the ValueChange script of the control.

In order to access the internal methods of the ListDataGrid, users have to use something like the following code :

Code

control.InputControl.GetGridItemValue(“Title”) 

The parameter provided should be the attribute name (column name) of the bound list query.

Note : The InputControl property provides access to the methods of the actual control.

, ,

The ListDataGrid control

The ListDataGrid control is useful to display data coming from other lists. Configuring the control only requires to define a list query.

For example assume we have 2 custom lists : Customers and Orders.

The requirement is display Customer Orders inside each Customer form. So we must define a query that will retrieve Orders using criteria from the existing customer record.

In the runtime designer of the Customer form, we add a new ListQuery.

We define the query parameters :

Url : The orders list url

List : The orders list

Criteria : We must lookup orders using the ID of the current customer record.

Ignore Blank Criteria : we shoudl uncheck this option since it indicates if the filter will be applied when the ID control has no value. This would retrieve all records from the orders list every time we create a new Customer record.

Attributes : We select the columns we want to display in our data grid. Note that for lookup columns we can use the {name:ColumnInternalName} or {value:ColumnInternalName} in order to display the ID or the Name part of the lookup value.

Headers : We define the headers for data grid columns.

Now we can add the ListDataGrid on the form.

Define the required height and in the advanced properties of the control, select the list we defined in our previous step.

 

, ,

The LookupPicker control

The LookupPicker can be used to display and select lookup data and is very similar to the simple ComboBox control but has some signifincant advantages :

  • No Data Loading is performed during form initialization providing faster form loading
  • Allows data filtering during run-time (including fields other than the Display field)
  • Multiple columns can be displayed from the source list

 

Multiple Search Fields and Display Fields inside the Lookup Picker Query List.

If the control is bound to a choice column, then the Static Values property is automatically filled with the underlying values from the column. The property is readonly as every change in the column values will be automatically reflected in the control values.

If the control is bound to a lookup column, then the list info should be filled in.

The Site Url, List (and/or View) properties should be defined.

The normal behaviour of lookup columns is to display the Title and save the ID of the selected record.

For that reason, 2 properties can be defined in the Lookup Details tab : Display Field & Value Field.

These properties should be automatically filled when first registering PowerForms for an existing list/content type.

In order to add criteria for the list query that will provide control data, use the criteria options.

 Details on how to setup criteria can be found in the following links :

List Query Criteria

Complex List Query Examples

 

Available Properties

ButtonVAlign

Sets the vertical alignment of the browse/search button

AllowBlankSearchText

Defines if the user is allowed to search the list without providing text-search criteria

Sorted

Defines if the results will be sorted by the Display Field

AutoLoadDisplayMember

If selected, the control loads the display field of the record provided if not included in the value (can be used in external lists)

SaveValueFieldOnly

Set this property to TRUE to force the control to send only the Value Member value of the underlying lookup value when saving its value. Normally lookup controls that load data from other lists, use the ID;#TITLE format to save data

SearchAnyPartOfText

If selected, searches the provided text in any part of the taregt column value. If not, returns the records that begin with the provided text.

UniqueField

If the internal name of a column is supplied, the retrieved results will be filtered allowing unique values for that specific field

EnableSearchOnFocus

This property defines if the control will display a search textbox when it receives focus, allowing users to type criteria and activate search by pressing the enter key

SearchFields

Define the fields that you want to search with. It the property is blank, then the display member will be used. The Name, Header, Operator (Equals, BeginsWith etc) and QueryType (Text, Lookup, etc) can be defined for each field.

DisplayFields

Define the fields that will be retrieved and displayed in the results list. It the property is blank, only the display member will be retrieved. The Name, Header and ColumnWidth can be defined for each field. You should use fixed width for the first column is multiple columns are displayed to achieve best results.

, ,

The ComboBox control

The ComboBox is a simple dropdown list control that can contain either static values (for example choice column data) or values retrieved from another list (lookup column data)

 

If the control is bound to a choice column, then the Static Values property is automatically filled with the underlying values from the column. The property is readonly as every change in the column values will be automatically reflected in the control values.

If the control is bound to a lookup column, then the list info should be filled in.

The Site Url, List (and/or View) properties should be defined.

The normal behaviour of lookup columns is to display the Title and save the ID of the selected record.

For that reason, 2 properties can be defined in the Lookup Details tab : Display Field & Value Field.

These properties should be automatically filled when first registering PowerForms for an existing list/content type.

In order to add criteria for the list query that will provide control data, use the criteria options.

 Details on how to setup criteria can be found in the following links :

List Query Criteria

Complex List Query Examples

 

Available Properties

SaveValueFieldOnly

Set this property to TRUE to force the control to send only the Value Member value of the underlying lookup value when saving its value. Normally lookup controls that load data from other lists, use the ID;#TITLE format to save data

 

Sorted

Defines if the results will be sorted by the Display Field

 

UniqueField

If the internal name of a column is supplied, the retrieved results will be filtered allowing unique values for that specific field