, ,

The ProgressBar control

The ProgressBar control can be used instead of a numeric textbox. The value can also by shown as a percentage.

 

 

Type : ProgressBar

Name

Provides a unique name for the control.

Binding

Indicates if the control is

  • Unbound
  • Bound to list column
  • Is a label for a control bound to list column

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”

Value

This property defines how the control will get its value.

 

Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.

Formula

A javascript expression must be set that will provide the value for the control.

If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.

Example :

Code

form.FieldValue(“c_Active”) ? “Yes” : “No”

There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :

If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.

If the Field Name is left blank, the first column retrieved will be used.

Web Service

The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the  retrieved item.

SQL Query

Works the same way ListQueries and Web Service works.

Example :

Code

=”User : ” + form.UserFullName()

Width

Defines the width of the control.

When the value is zero, the maximum allowed width will be used.

Please note that you can only change the Slider’s width using the above Layout property and not by adjusting the number of boxes it occupies on the designer view.

Height

Defines the control height.

If the value is zero, the height property will not be set.

Please note that you should also set the control’s height greater than 0.

H.Alignment

Defines the horizontal alignment of the parent cell (values : left, right, center)

V.Alignment

Defines the vertical alignment of the parent cell (values : top, bottom, center)

Fore Color

Defines the fore color of the control

Back Color

Defines the Background color of the control.

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

Not Applicable for this control

MinimumValue

Indicates the minimum value for the progress bar.

MaximumValue

Indicates the maximum value for the progress bar.

Decimals

Sets the number of decimals for the displayed value, default is 0.

Decimals

Sets the number of decimals for the displayed value, default is 0.

TextMode

Display the value as the actual value or as a percentage.

TextColor

Set the text’s color.

Sets the script that will be executed at the value-change event of the control.

Example :

Code

var value = form.GetControl(“c_Title”).GetValue();

if (value == “Open”) form.HideSection(“Details”);

else form.ShowSection(“Details”);

, ,

The DataGrid control

The DataGrid control is useful to display data coming from other lists using a list query, a web service call or an sql query.

Type : DataGrid

Name

Provides a unique name for the control.

Binding

Not applicable for DataGrig control. Always unbound.

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and binds the data grid

Web Service Call

A predefined web service is bound to the value of the control. So during form initialization, the specified list query is executed and binds the data grid

SQL Query

A predefined sql query is bound to the value of the control. So during form initialization, the specified list query is executed and binds the data grid

Width

Defines the width of the control.

When the value is zero, the maximum allowed width will be used.

Height

Defines the control height.

If the value is zero, the height property will not be set.

H.Alignment

Defines the horizontal alignment of the parent cell (values : left, right, center)

V.Alignment

Defines the vertical alignment of the parent cell (values : top, bottom, center)

Fore Color

Defines the fore color of the control

Back Color

Defines the Background color of the control.

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

 

 

PageSize

Define the page size for the grid. Zero indicates no paging.

ShowGroups

This property enables or disables grouping for the grid data

ListQueriesPerPage

If this property is set to True, the Record List Queries defined for this grid, will not be executed all at once during data load, but for every page in the grid (in case paging is activated). This can greatly improve loading performance for the data grid

SelectionChangedScript

You can write a script that will be executed once the selection is changed. The ‘item’ variable is available containing the item selected or null if the grid has no item selected

DataLoadedScript

You can write a script that will be executed once the data to be bound to the datagrid are loaded, just BEFORE they are placed in the grid. The ‘items’ variable is available containing the items retrieved. This event is used if you want to alter the items before they are shown.
Code
for (var i=0; i < items.length; i++)
{
   items[i].KPILookup = GetNameFromLookup(items[i].KPILookup);
}

 

 

LoadCompletedScript

Occurs AFTER the data have been placed inside the grid. The ‘items’ variable is available containing the items retrieved

Example :

Code

for (var i=0;i<items.length;i++) {
var c = items[i].ItemCount;
items[i].Image = “<center><img width=’24’ height=’24’ src=\”http://wssdev1/Docs/chat.png\” /></center>”;
}

 

 

DaysToShowNewIndicator

Define the duration (in days) for which the new indicator will be shown in the Field(s) where ShowNewIndicator=true. The duration is compared with the Created Date (‘Created’ field) of the record.

NewIndicatorImageURL

Specify the url of the image to display as a ‘new’ indicator.

 

Fields

Add the fields of the data entry grid

Properties

Name : The name of the field. It should begin with a letter and only contain letters, numbers and the underscore character

Header : The field header

Width :  The grid column width. Leave blank for Auto sizing.

DisplayFormat : Indicates the way the value will be presented inside the data grid. (The value as-is, the ValueField or DisplayField for lookup controls (ID;#TITLE).

FormatString : Sets the format for Date and Number fields. For example ‘#,##0.00’ or ‘MM/dd/yyyy’.

ForeColor : The cell foreground color

FontBold :  The text weight

FontSize : The size of the font used

ColumnFiltering :  If selected, then the grid displays a dropdown menu when the user clicks this column, for filtering and sorting purposes.

HAlign :  Sets the Horizontal Alignment. (Left, Center, Right)

ShowNewIndicator :  If this property is set to True, the sharepoint ‘new’ indicator will be shown next to the column value.

 

 

Hyperlinks

We are very happy to announce this brand new property for the DataGrid control. The Hyperlink property converts cell contents to hyperlinks, which when clicked, open a popup form to edit the corresponding entities. These popup forms look exactly the same, like when editing the item on the parent Sharepoint list, since they share the same customization.

 

An example of using Hyperlinks on two Datagrid columns (Name and Primary Contact) is shown below:

Clicking on a Hyperlink, the popup form appears:

 

In order to set a column to contain hyperlinks, you should create a Link using the following parameters:

ListUrl : The list’s site Url.

ListName : The list’s name.

FieldName : The field on the Datagrid that will be converted to a hyperlink.

IDFieldName : The field that contains the ID that will be used to open the edit form. This will be either the ID or a lookup column.

FormWidth : The popup form’s width.

FormHeight : The popup form’s height.

Style :  The hyperlink’s style. For example : text-decoration:none;color:black;

 

The hyperlinks on the above picture were created using the following Link parameters:

 

RecordListQueries

Define additional List Queries that will be executed for each item record retrieved. These can be used to retrieve additional information, even from other lists, for each record in the DataGrid.
Properties
ListQuery : The list query name.
SearchTargetField :  The internal column name of the query that we want to apply criteria.
SearchSourceField :  A field defined on the DataGrid control, whose value will be used as a criteria to filter the list query results.
SearchOperator :  The criteria operator. Possible Values: BeginsWith, Contains, Equals, NotEquals, Greater, GreaterOrEqual, Less, LessOrEqual, IsNull, IsNotNull
SearchType :  The criteria type. Possible Values: Text, Counter, Lookup, DateTime, Number
InitScript :  This script will be executed for each item before executing the list query. The variable ‘item’ is available, containing the current record. You can write custom JS code, to possibly change a value in the record, before performing the actual list query.
CallbackScript : The script that will be executed, once the list query returns the results. The variables ‘item’ and ‘result’ are available. The item represents the current record and the result represents the list query results, based on the current record. Available properies : result.ErrorMessage, result.ListItems

 

 

It is worth noting that you can opt to cancel a RecordListQuery from executing, by using the InitScript and setting e.Cancel = true; For example, using the InitScript:

Code
if (form.GetControl(“c_SomeRandomControl”).GetValue() == “0”)

 

{
     e.Cancel = true;
}

 

In controls like Datagrid and DataEntryGrid there are also some extra methods that can help you handle fields and rows in the grids.They use the InputControl property of these controls.The available methods are:

GetSelectedItem

This method returns an object item with the selected row of the grid.

Code

var item =  form.GetControl(“c_GridName”).InputControl.GetSelectedItem();

RefreshGrid

This method refreshes the grid’s content.

Code

form.GetControl(“c_GridName”).InputControl.RefreshGrid();

 

GetAllItems

This method returns a array of all object items that are bound to the grid

 

Code

var items =  form.GetControl(“c_GridName”).InputControl.GetAllItems();

 

 

Some examples:

How to get selected item from a grid called ‘c_GridName’ and set Title value to a label called ‘c_Label’.

Code

var item = form.GetControl(“c_GridName”).InputControl.GetSelectedItem();

form.GetControl(“c_Label”).SetValue(item.Title);

 

How to loop through all items and find the sum of a field called ‘Quantity’

 

Code

var sum = 0;

var items = form.GetControl(“c_GridName”).InputControl.GetAllItems();

 

for (var i=0; i < items.length; i++)
{
  sum = sum + items[i].Quantity;
}

 

 

 

ExportToExcel

As the name suggests, this function will export the data to an Excel file, ready to be saved or opened. The function accepts three parameters, described below:

ExportToExcel(array of columns, string file name, string sheet name) 

 

Columns should be an array of objects with “field” and “title” properties. If no columns are provided, all of the grid’s visible columns will be exported.

Example:

Code
var grid = form.GetControl(“c_Cases”).InputControl;

 

var cols = [];
cols.push({field:”CaseNumber”, title:”Case Number”});
cols.push({field:”Title”, title:”Title”});
cols.push({field:”CaseType”, title:”Case Type”});
cols.push({field:”CType”, title:”Case Category”});

 

grid.ExportToExcel(cols, “Cases.xls”, “Cases”);

 

SelectRowByIndex

As the name suggests, this function will select a row on the DataGrid. The function accepts one parameter, as described below:

SelectRowByIndex(integer theIndex) 

 

Example:

Code
form.GetControl(“c_DataGrid”).InputControl.SelectRowByIndex(1);

 

RunListQueries(all, callback)

This function runs all the list queries that have been declared at the property of the DataGrid named RecordListQueries. The function accepts the parameter ‘all’ that describes the case that the user wishes to run the list queries for all the items of the DataGrid or only the visible ones, as described below:

Example:

Code
form.GetControl(“c_DataGrid”).InputControl.RunListQueries(true, function(){  });
, ,

The PeoplePicker control

The PeoplePicker control is used to load  users and groups from two different sources. It can access data from sharepoint or from Active Directory.

The users and groups are not loaded during form startup so this control is the most suitable to display large amount of users and groups.

It allows users to search for  the required value using a popup search form, activated by the “Browse” button.

The value of the control is in the following format (when accessed from script using the GetValue() method) :

Code

// Bound to lookup entity

ID1;#USERNAME1

Type : PeoplePicker

Name

Provides a unique name for the control.

Binding

Indicates if the control is

  • Unbound
  • Bound to list column
  • Is a label for a control bound to list column

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”

Value

This property defines how the control will get its value.

 

Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.

Formula

A javascript expression must be set that will provide the value for the control.

If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.

Example :

Code

form.FieldValue(“c_Active”) ? “Yes” : “No”

There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :

If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.

If the Field Name is left blank, the first column retrieved will be used.

Web Service

The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the  retrieved item.

SQL Query

Works the same way ListQueries and Web Service works.

Default Value

The default value has any effect only of the control is bound to a list column.

For unbound controls, the default value is ignored.

You may set a static value here or use a formula by starting your input with the “equals” (=) sign.

Code

1;#Administrator

Width

Not applicable

 

Height

Not applicable

 

H.Align

Not applicable

 

V.Align

Not applicable

 

 

Fore Color

Not applicable

 

 

Back color

Not applicable

 

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

This control belongs in  the People controls which have only one method enabled.

The method enabled is :

Users/Groups

This is the default method if the underlying column is a people column.

People only

The property indicates that only users (not Groups) will be included in the retrieved lookup records

Preload data

Cannot be set in People Combo box. In People Picker and MultiPeople Picker if this property is checked, the records will be loaded automatically when opening the search popup dialog.

Specific Group(s)

Users can select one or more SharePoint groups to restrict results loading users only from the specified groups. This options is available only when the “People Only” property is selected.

 

ActiveDirectorySearch

When this property is set to True, the control searches Active Directory users also the same way that SharePoint does in People Pickers and requires the user to provide a search filter. If set to False, it retrieves users and groups from SharePoint groups.

AllowFreeTextEntry

Allows the user to input a free-text user name/email into the people picker textbox. Useful in custom claims provider cases where out of the box user search and validation does not work.

Sets the script that will be executed at the value-change event of the control.

Example :

Code

var value = form.GetControl(“c_Title”).GetValue();

if (value == “Open”) form.HideSection(“Details”);

else form.ShowSection(“Details”);

 

, ,

The DataEntryGrid control

It is a datagrid with which a user can enter, edit or delete information. The control operates in two modes:

1) Single list mode, where it stores the detail information into a column of type multiple lines of text (note: the column must use Plain Text format). In this case, the data are saved in XML format.

2) Multiple list mode, where the data are stored in a separate list (using list query to load data and then save them).  See master detail using DataEntryGrid control tutorial for details.

 

Type : DataEntryGrid

Name

Provides a unique name for the control.

Binding

Indicates if the control is :

1) Unbound. This should be the case the control stores its data in a separate list. See master detail using DataEntryGrid control tutorial for details.

2) Bound to a list column: When bound to a multiline text column (plain text), it will save the detail rows in XML format.

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”

 

Value provided by the user

With this choice made, the dataentrygrid is not bound to another list but its data are saved within the same list in a multiple line plain text column.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and binds the dataentry grid

 

 

Width

Defines the width of the control.

When the value is zero, the maximum allowed width will be used.

Height

Defines the control height.

If the value is zero, the height property will not be set.

H.Alignment

Defines the horizontal alignment of the parent cell (values : left, right, center)

V.Alignment

Defines the vertical alignment of the parent cell (values : top, bottom, center)

Fore Color

Not applicable

Back Color

Not applicable

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

 

 

AllowInsert

Allows new records to be added in the grid

AllowUpdate

Allows users to update records

AllowDelete

Allows users to delete records from the grid

UseKeyNavigation

This property (true/false) provides the user with the ability to jump forward from cell to cell using the TAB key, or the SHIFT+TAB for backward way.

ButtonsHorizontalPosition

Sets the Horizontal positioning of the New/Delete buttons in relation to the grid.

ButtonsVerticalPosition

Sets the Vertical positioning of the New/Delete buttons in relation to the grid.

ButtonsPositioningMode

Sets the positioning mode of the New/Delete buttons. ‘Inline’ means that the buttons will be displayed in an absolute positioning mode without taking extra space on the bottom (or top depending on the alignment) of the grid. Useful when you want to add extra controls next to the buttons.

InsertButtonImageURL

Render an image instead of a button for the ‘New Record’ button.

DeleteButtonImageURL

Render an image instead of a button for the ‘Delete Record’ button.

DataItemChangedScript

You can write a script that will be executed once a dataitem value is changed. The event is only raised when using existing controls. The ‘fieldName’ parameter contains the property name that raised the change. You can get the underlying dataitem using the control.InputControl.GetSelectedItem() method and you can change the value of a property in the item using the item.SetValue(fieldName, value) method.

SelectionChangedScript

You can write a script that will be executed once the selection is changed. The ‘item‘ variable is available containing the item selected or null if the grid has no item selected.

Example:

Code
if(item != null)
{
 alert(item.Title);
}

 

DataLoadedScript

You can write a script that will be executed once the data inside the datagrid is loaded (when the control is bound in a List Query). The ‘items‘ variable is available containing the items retrieved.

This is the perfect time to make changes to the data loaded, before they are finally placed inside the DataEntryGrid control.

Code
for (var i=0; i < items.length; i++)
{
   items[i].KPILookup = GetNameFromLookup(items[i].KPILookup);
}

 

LoadCompletedScript

Occurs AFTER the data has been placed inside the grid (assuming the control is bound to a List Query). The ‘items‘ variable is available, containing the items retrieved.

 

CellEnteringEditScript

You can write a script that will be executed when a grid cell enters edit mode, providing the ability to close the cell and cancel the edit process.

The ‘e’ object contains the event parameters, and you can set e.Cancel to true in order to cancel editing

 

e.FieldName is the name of the column that is currently being edited.

e.DataItem contains the currently selected record’s data.

 

Example:

Code

if (e.FieldName == ‘Title’ && e.DataItem.Description == ‘Skip editing’) {

e.Cancel=true;

}

 

ExistingControlCreatedScript

You can write a script that will be executed once an existing control is created within an edit cell of the grid (applicable only in case you have fields with Type = Existing). This is useful when we want add extra manipulation on the control that is used to edit the data item.
The ‘e‘ object contains the event parameters :

 

e.FieldName is the name of the column that is currently being edited.

e.DataItem is the actual record.

e.Control is the form control that is created within the cell.

 

Example:
Code
if (e.FieldName == ‘Title’ && e.DataItem.ItemColor == ‘Red’) {
   e.Control.SetBackColor(‘red’);
}

 

 

Fields

Add the fields of the data entry grid

Properties

Name : The name of the field. It should begin with a letter and only contain letters, numbers and the underscore character

Header : The field header

Type : The control type. Possible values are Textbox, DatePicker, Combobox, Checkbox, Existing, NoEdit (to make a non-editable, read-only field)

ExistingControlName : When the control type is ‘Existing’ you can set the name of an existing control on the form (should normally be hidden and dedicated for this purpose). That control will be used in the data entry form.

Width :  The grid column width. Leave blank for Auto sizing.

DisplayFormat : Indicates the way the value will be presented inside the data grid. Possible values are:

– (denotes no formatting, displaying the value as-is),

ValueField or DisplayField for lookup controls (ID;#TITLE),

Date for date fields (can be used in conjunction with the FormatString property),

DateTime for date-time fields (can be used in conjunction with the FormatString property),

Number (can be used in conjunction with the FormatString property).

FormatString :  Sets the format for Date, DateTime and Number fields. For example #,##0.00 orMM/dd/yyyy

Required : Defines if the field is required

BackColor : The cell background color

ForeColor : The cell foreground color

FontBold :  The text weight

FontSize : The size of the font used

HAlign :  Sets the text’s Horizontal Alignment. Possible values: – (default alignment), Left, Right, Center

Values :  Array of string values that will be used as the data source of the control when the type is ComboBox

DefaultFieldValue : Specifies the default value to be given to the field in new items. The value can contain expression that refers to another control, for example {c_Title} in order to retrieve text from the control named c_Title.

CustomCellTemplateFormula : You can define a custom javascript formula that is going to be evaluated on runtime to produce the cell content. Use data field names as variables, for example: ‘<b>’ + Title.toUpperCase() + </b>’

ColumnFiltering : If selected, then the grid displays a drop-down menu when the user clicks this column, used for filtering purposes.

Values

Add Name/Value pairs to update item properties when the control is bound to a list. Values could be either static or calculated. (i.e. Name=Priority, Value=High or Name=Customer, Value={value:c_ID}. You can use the {ParentID} keyword for the value property to set the ID of the parent record (event if not saved yet).

Properties

Name : The column internal name

Value : The default value of the column. Set either static values or calculated values based on form controls (i.e. {value:Field1}). You can use the {ParentID} keyword for the value property to set the ID of the parent record (event if not saved yet).

 

 

 

RecordListQueries

Define additional List Queries that will be executed for each item record retrieved. These can be used to retrieve additional information, even from other lists, for each record in the DataEntryGrid.

 

Properties

 

ListQuery : The list query name.

SearchTargetField :  The internal column name of the query that we want to apply criteria.

SearchSourceField :  A field defined on the DataEntryGrid control, whose value will be used as a criteria to filter the list query results.

SearchOperator :  The criteria operator. Possible Values: BeginsWith, Contains, Equals, NotEquals, Greater, GreaterOrEqual, Less, LessOrEqual, IsNull, IsNotNull

SearchType :  The criteria type. Possible Values: Text, Counter, Lookup, DateTime, Number

InitScript :  This script will be executed for each item before executing the list query. The variable ‘item’ is available, containing the current record. You can write custom JS code, to possibly change a value in the record, before performing the actual list query.

CallbackScript : The script that will be executed, once the list query returns the results. The variables ‘item’ and ‘result’ are available. The item represents the current record and the result represents the list query results, based on the current record. Available properies : result.ErrorMessage, result.ListItems

 

 

Sets the script that will be executed at the value-change event of the control.

Example :

Code

var value = form.GetControl(“c_Title”).GetValue();

if (value == “Open”) form.HideSection(“Details”);

else form.ShowSection(“Details”);

 

 

 

ExportToExcel

As the name suggests, this function will export the data to an Excel file, ready to be saved or opened. The function accepts three parameters, described below:
ExportToExcel(array of columns, string file name, string sheet name)
Columns should be an array of objects with “field” and “title” properties. If no columns are provided, all of the grid’s visible columns will be exported.
Example:
Code
var grid = form.GetControl(“c_Cases”).InputControl;
var cols = [];
cols.push({field:”CaseNumber”, title:”Case Number”});
cols.push({field:”Title”, title:”Title”});
cols.push({field:”CaseType”, title:”Case Type”});
cols.push({field:”CType”, title:”Case Category”});
grid.ExportToExcel(cols, “Cases.xls”, “Cases”);

 

 

SelectRowByIndex

 

As the name suggests, this function will select a row on the DataEntryGrid. The function accepts one parameter, as described below:
SelectRowByIndex(integer theIndex)
Example:
Code
form.GetControl(“c_DataEntryGrid”).InputControl.SelectRowByIndex(1);

 

RefreshGrid

This method refreshes the grid’s content.

Code

form.GetControl(“c_GridName”).InputControl.RefreshGrid();

 

AddNewRow(item)

As the name suggests, this function will add a new row on the DataEntryGrid. The function accepts one parameter (a new Object), as described below:
Example:
Code

var item = new Object();

item.Title = “TestTitle”;

item.Bank = “TestBank”;

 form.GetControl(“c_DataEntryGrid”).InputControl.AddNewRow(item);

RunListQueries()

This function will run all the list queries that have been declared at the property of the DataEntryGrid named RecordListQueries. It works as described below:
Example:
Code
 form.GetControl(“c_DataEntryGrid”).InputControl.RunListQueries();

 

 

GetAllItems()

This function returns all items currently shown on the DataEntryGrid Control. You can also use SetValue, to programmatically change column values.

 

Example:

Code
// retrieving all items in the DataEntryGrid control
var thecvDset = form.GetControl(“yourDataEntryGrid”).InputControl.GetAllItems();
// looping through each item in the array
for (var i = 0; i < thecvDset.length; i++) {
    var theTitle = thecvDset[i].Title;
    // changing the Title column value in every row
    thecvDset[i].SetValue(“Title”, theTitle + “123”);
}
, ,

The PeopleComboBox control

The value of the control is in the following format (when accessed from script using the GetValue() method) :

Code

// Bound to lookup entity

ID1;#USERNAME1

Type : PeopleComboBox

Name

Provides a unique name for the control.

Binding

Indicates if the control is

  • Unbound
  • Bound to list column
  • Is a label for a control bound to list column

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”

Value

This property defines how the control will get its value.

 

Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.

Formula

A javascript expression must be set that will provide the value for the control.

If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.

Example :

Code

form.FieldValue(“c_Active”) ? “Yes” : “No”

There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :

If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.

If the Field Name is left blank, the first column retrieved will be used.

Web Service

The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the  retrieved item.

SQL Query

Works the same way ListQueries and Web Service works.

Default Value

The default value has any effect only of the control is bound to a list column.

For unbound controls, the default value is ignored.

You may set a static value here or use a formula by starting your input with the “equals” (=) sign.

Example :

Code

1;#Administrator

Width

Defines the width of the control.

When the value is zero, the maximum allowed width will be used.

Height

Defines the control height.

If the value is zero, the height property will not be set.

H.Alignment

Defines the horizontal alignment of the parent cell (values : left, right, center)

V.Alignment

Defines the vertical alignment of the parent cell (values : top, bottom, center)

 

Fore Color

Not applicable

Back Color

Not applicable

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

This control belongs in  the People controls which have only one method enabled.

The method enabled is :

Users/Groups

This is the default method if the underlying column is a people column.

People only

The property indicates that only users (not Groups) will be included in the retrieved lookup records

Preload data

Cannot be set in People Combo box. In People Picker and MultiPeople Picker if this property is checked, the records will be loaded automatically when opening the search popup dialog.

Specific Group(s)

Users can select one or more SharePoint groups to restrict results loading users only from the specified groups. This options is available only when the “People Only” property is selected.

 

Sets the script that will be executed at the value-change event of the control.

Example :

Code

var value = form.GetControl(“c_Title”).GetValue();

if (value == “Open”) form.HideSection(“Details”);

else form.ShowSection(“Details”);

 

, ,

The ComboBox control

The ComboBox control

The value of the control is in the following format (when accessed from script using the GetValue() method) :

Type : ComboBox

Name

Provides a unique name for the control.

Binding

Indicates if the control is

  • Unbound
  • Bound to list column
  • Is a label for a control bound to list column

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Value

This property defines how the control will get its value.

 

Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.

Formula

A javascript expression must be set that will provide the value for the control.

If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.

Example :

There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :

If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.

If the Field Name is left blank, the first column retrieved will be used.

Web Service

The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the  retrieved item.

SQL Query

Works the same way ListQueries and Web Service works.

Default Value

The default value has any effect only of the control is bound to a list column.

For unbound controls, the default value is ignored.

You may set a static value here or use a formula by starting your input with the “equals” (=) sign.

Example :

Width

Defines the width of the control.

When the value is zero, the maximum allowed width will be used.

Height

Defines the control height.

If the value is zero, the height property will not be set.

H.Alignment

Defines the horizontal alignment of the parent cell (values : left, right, center)

V.Alignment

Defines the vertical alignment of the parent cell (values : top, bottom, center)

Fore Color

Defines the fore color of the control

Back Color

Defines the Background color of the control.

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

This control belongs in  the Lookup controls and can provide users with a set of values to select from.

The values can be retrieved from a variety of methods :

List

This is the default method if the underlying column is a lookup column.

Lookup Url

You must define the url of the site containing the target list

Source List

Select the required list from the dropdown control.

Source View

Selecting a view is optional.

If a view is selected then a) the criteria of the view will be combined with the criteria provided here, b) the sorting of the view will be used.

Criteria

You can provide multiple search criteria by opening the criteria editor.

Display Field

Select the field that will be used as the display member of the result set

Value Field

Select the field that will be used as the value member of the result set.

Constraint By

You can select a column of the current record that will be used to filter values from the target list

Match To

If you selected a value for the “Constraint By” property, you must select the column of the target list that will be filtered by the value of the “Constraint By” column.

The form will automatically identify changes in the control bound to the “Constraint by” column and refresh the lookup data.

If the “Constraint By” and “Match To” properties are filled, then the “Query Type” property should be set to set the type of query that will be performed. (Values: Text, Lookup)

Predefined List Query

You may select a List Query already defined in the “List Queries” section of the designer.

All the query parameters (columns retrieved, criteria, sorting, etc) should be defined in the List Query definition.

In the Lookup Details section, users should select the required list query and the Display and Value field of the control. Both fields should be retrieved by the list query.

Web Service

 

Lookup values from web services can be used as lookup values for controls.

The web service should be already defined in the “Web Services” section of the designer.

The Display and Value fields should be set here by selecting 2 of the fields retrieved by the web service.

Static Values

 

Static values can be defined as lookup values for a lookup control.

If the underlying column is a choice column, then the list of values cannot be changed by the user.

 BDC Data

This option should only be used for SharePoint 2007.

 

If a control is bound to column that references BDC data then the options here should be already filled in.

You can define the Application instance, the BDC Entity and Display/Value fields.

Managed Metadata

This option should only be used in SharePoint 2010.

 

SharePoint 2010 supports the definition of data sets across multiple sites and site collections using a hierarchical structure. You can define the TermSet (id or name), the Anchor ID (optional : the guid of the term that will be used as the root term for search) and the “Taxonomy Keyword” checkbox which defines if search will be performed across term sets.

 

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

ValueFieldFormat

Values : Id, Title

Applies formatting for the value field when the value is a lookup value (ID;#TITLE format).

If “Id” is used, then the “ID” part of the value will be used for the value member of the control.

If “Title” is used then the “Name” part of the value will be used.

DisplayFieldFormat

Values : Id, Title

Applies formatting for the display field when the value is a lookup value (ID;#TITLE format)

If “Id” is used, then the “ID” part of the value will be used for the display member of the control.

If “Title” is used then the “Name” part of the value will be used.

NOTE :

You can use the “ValueFieldFormat” and “DisplayFieldFormat” properties of this control to fill a lookup controls with all the available values found in a lookup column of a list.

For example :

To fill a customer combo, with all customers that have placed an order within the last month (Customer is a lookup column inside the Orders list) :

Select the “Orders” list as the target list applying the appropriate date criteria.

The “Display Field” should be set to “Customer”

The “Value Field” should be set to “Customer”

Example value of the Customer column inside the Orders list : “32;#CUSTOMER-A”

The ValueFieldFormat should be set to “Id” (getting the “32” part)

The DisplayFieldFormat should be set to “Title” (getting the “CUSTOMER-A” part)

The combined value has the required format for the lookup control (ID;#NAME)

Unique customers can be enforced using the “UniqueField” property of the control.

Sets the script that will be executed at the value-change event of the control.

Example :