, ,

Define Hierarchical Comboboxes

In common scenarios, there are linked lists that need to be included as hierarchical comboboxes in your forms.

For example a typical Country/City scenario would include 2 lists.

–  Countries (ID, Title)

–  Cities (ID, Title, Country) where the Country field is a lookup for the Country List.

In order to declare the comboboxes for these lookups, you must follow the normal procedure to declare the combobox lookups (list url, list name, display field, value field) and then for the City combobox in the Lookup Details tab, you must select the Constraint By field (it is the field in the current form where the Country is stored) and the Match To (it is the Country field inside the Cities list).

 

After configuration, the form automatically identifies changes in the constraint fields and reloads the depedent list using the criteria provided.

 

For example, selecting France as country loads only the relevant cities in the CityForCascade combobox:

 

In our second example, we select USA as country and observe how CityForCascade loads the relevant cities once more:

 

Additional criteria can be applied to the list query by using the “Lookup Criteria” property. Instructions on how to add criteria can be found using the following links:

List Criteria

, ,

Declaring a Lookup/Combobox Control

Available options:

Choice Control (Single Selection)

Declare a new ComboBox or LookupPicker control. Set the Target Field Name and in the Lookup Details tab, set the Lookup Static Values property adding all the required values concatenated by semicolon (;).

For example for a rating field : Low;Medium;High

During initial form customization, the form designer identifies the choice controls and prepares the values for you.

Choice Control (Multiple Selections)

Declare a new MultiLookupPicker control, set the Target Field Name and set the Lookup Static Values property (values concatenated by semicolon). The MultiSelect propertyin the General tab should be checked.

For example : SALES;SUPPORT;SERVICE;MARKETING

Lookup Control (Single Selection)

Declare a new ComboBox or LookupPicker control

In the Lookup Details tab, set the Lookup Url (for example http://servername). As soon as the property is updated, the Lookup List combobox is filled with the available lists found. Select the required List and the required view (optional).

If you need you may set criteria to query the list in the field Lookup Criteria. The criteria are defined using the Criteria Editor.

Available values for the Operator are : Equals, NotEquals, Greater, GreaterOrEqual, Less, LessOrEqual, IsNull, IsNotNull, BeginsWith, Contains.

Available values for the type are : Text, Counter, DateTime, Lookup, Number

Next, select the Lookup Display Field (usually Title) and the Lookup Value Field (usually ID, unless you have selected to store a different field in your form).

If you decide to create a ComboBox field, all values are loaded during startup. For long lists, you should select the LookupPicker control. The LookupPicker allows the user to search for the required value by opening a popup dialog. If you still decide to present all the values during popup loading, you should check the Preload Lookup Data checkbox.

, ,

Localization in PowerForms

PowerForms can be localized through the Localization Section in the designer.

 

 

A list containing all the texts appearing inside forms either in controls, buttons or messages is displayed and the user can change the required texts. The list supports Unicode so changing the texts to fit your needs should not be a problem.

 

 

For performance and simplicity reasons, the localization list can be saved separately in a xml file. In order to achieve this, an XML export button is available in the designer toolbar :

 

 

Press the export button and copy the “<Translations>” section of the XML specification (meaning from the “<Translations>” element until the “</Translations>” element) :

 

Place it in a text file, save as Unicode and upload it in the BPC PowerForms Binaries document library or another accessible Url. Then in the form options section, define the absolute url of the xml localization file.

 

 

Using this mechanism you can achieve simpler localization support for multiple forms, as a single xml file can support localization for all the forms in your site collection. Multiple files can be defined to support multiple languages as soon as you set the appropriate url in the “Localizations Url” property of the designer options section.

, ,

The {url} Keyword

The {url} is a brand new keyword which can be used in the designer to indicate the local web-site url, instead of having to write the whole SharePoint site/sub-site path.

Important Note:

The {url} keyword can be used to substitute the full site/sub-site url when creating lookup controls or list queries.

 

Up to this point, when you had to create a new List Query using PowerForm’s designer, you had to enter the full path to the Site Url property. E.g.

 

Using the new {url} keyword, you can now accomplish the same thing with less effort. E.g.

, ,

Multiple Sorting in List Queries

A new addition to PowerForms HTML is the ability to sort by multiple columns in a List Query.

 

 

Clicking on the Sort with multiple columns presents a text-box which you can use to perform multiple sorting to your list query. As the description says:

 

Use semicolons (;) to separate column internal names. Sorting is by default ascending. You can add a minus (-) sign at the end of the column name to indicate descending sort.

Example:

 

Category-;Title

 

will sort the list query by Category descending and Title ascending.

, ,

Master-Detail using the DataEntryGrid control

The DataEntryGrid control gives you two options. The first option is to add structured data that would be saved inside a multi-lines-of-text control (using XML). So it is ideal for cases that no external list is required to store the related data.

The second option is to bind the DataEntryGrid control value to a ListQuery, it can manage records that reside inside a separate list. It also has a unique feature :

The data changes are performed in a batch mode, meaning that all changes are applied as soon as we save the master record. It also has another feature :

It allows to insert records in a separate list, event if we are adding a new master record.

For example, we are inserting a new Purchase Order record. Before saving the record, we provide multiple order line items using the DataEntryGrid control. As soon as the users saves the Order record, all related Order-Line-Items will be inserted and get connected to the master record. In order to accomplish that, the control sends all data in a batch mode to the server and if we are dealing with a new master record, it first saves the master record, keeps the ID of that record and uses it to insert all data provided in the DataEntryGrid control.

Here is an example on how to setup that control :

We first create 2 lists (Customers and Contacts).

Customers list columns

Title, Address

Contacts list columns

Title (renamed to Full Name), LastName (single line of text, renamed to “Last Name”), FirstName (single line of text, renamed to “First Name”), Email (single line of text), Customer (lookup on the Customers list)

We first register PowerForms for the Customers form and start customization:

First we should create a list query that will retrieve related contacts for the current customer record :

In our Customer form, we first define a ListQuery that will retrieve only the connected  contacts (for the current Customer). The field that connects the 2 list is : Customers.ID = Contacts.Customer, so our query will use criteria on the Customer field of the Contacts list.

 

And the criteria added is based on the control c_ID which contains the ID of the current Customer record.

Notice that we have cleared the “Ignore Blank” checkbox, since that would retrieve ALL contacts when we were inside a new customer record (ID would be blank in that case).

Moreover, we use a criteria type = “Lookup” since the “Customer” column for which we apply the criteria, is a lookup column and we provide the ID part of its value.

We then add a DataEntryGrid control on the form to hold the contact records.

We set its height to fit our needs and we bind the control to get values from the ListQuery :

We now have to define the fields for the DataEntryGrid.

The DataEntryGrid control supports simple controls (like TextBox, DatePicker, static Combo, Checkbox) but to achieve the best result we could use Existing controls. To do that, we must first create some controls on the form (that will be used to data entry inside the grid), then hide them and use the control names (by selecting “Existing” in the control type)in the configuration of the grid fields.

We add the following controls below :

c_ContactTitle (a textbox control)

c_ContactLastName (a textbox control)

c_ContactFirstName (a textbox control)

c_ContactEmail (a textbox control)

We make the c_ContactTitle control ReadOnly and set to get its value from the c_ContactLastName and c_ContactFirstName controls by using a value formula : FieldValue(“c_ContactLastName”) & ” ” & FieldValue(“c_ContactFirstName”).

We then hide the controls using the appropriate button in the toolbar.

In the Extra tab of the control properties window we then define the fields :

Contact Title

Contact Last Name

Contact First Name

Contact Email

and then we define the Values we want to provide programmatically to each record using the “Values” property of the Extra configuration. There you can define Name/Value pairs to provide default values to columns of the targeted list.

For example you can provide a pair like :

Name = Active, Value = 1

or a calculated pair :

Name = Active, Value = {c_Active}

to get the value from an control of the existing form.

If you want to provide the ID of the current record, instead of using the {c_ID} keyword, you can provide the :

{ParentID} keyword which will work event if the current record has no ID yet (a new record).

All changes are kept and applied as soon as the user selects to save the current record.