Recent Changes - Search:

ProReports

edit SideBar

Respect my work!
If you are using commercially
ProReports please
bay a license:

or

        BTC: 

1MTFbBSKrocPK7G6GKfG8RoTw5N57WnnNa

If you have paid donate send me e-mail with Your data or transaction number to receive an access code to articles with limited access.

Form register

General concept of creating forms

Most of the reports require entering parameters like: client number, date etc. So it's justified before report generation to show form, in which you can enter mentioned parameters. Therefore ProReports system is equipped in mechanism of defining forms. Whole concept is based on desktops which idea is shown on below image:

As you can see, desktop is area of a form where you can put other desktops (e.g. on the left side of the image - row are put in column) or other form elements (fields). Thanks to this approach you can design desired form view.

Layer can look like this:

  • row - allows to arrange fields horizontally
  • column - allows to arrange fields vertically
  • group - allows to wrap multiple row or column into one group marked with heading bar
  • grid - allows to arrange fields in chess-field manner, e.g. grid sized 3x3:
Field 1Field 2Field 3
Field 4Field 5 

As mentioned, layer can be nested, meaning that for each new layer you can select "parent" layer (parent layer). Thanks to that you can gain absolute freedom in arranging form elements.

Often when designing from (mainly when doing it first time) it may be very helpful to draw it on a sheet of paper. It helps defining each desktop and form field.

Form registering

To register new form you can use following option Resources->Add form or using buttons: Add form in option Resources->List of form. After selecting one of the options below form will be shown:

where you need to enter:

  • form width (for most forms value 400 will work best)
  • name (any alphanumerical value, so you can't user underscore "_" or dash "-")
  • title displayed when presenting form

Layer registration

To register a layer use the following option: Resources->List of forms. After selecting correct form you need choose from menu option Layers:

Then you can enter layers list that have been defined for each form:

Pressing button Add layer lets you register new desktop for previously selected form.

Registering layer of type Column

When registering layer of type Column the most important is to set:

  • layer name
  • layer title (title will be shown as a column header - if you don't want this then enter:  )
  • parent layer (of a layer inside which this column will be insert) - if you don't select any parent layer then newly registered layer will be set in main layer of a form

Other fields are used to specify format of registered column (check description on a image above). Field Justify sets alignment of a column inside a form. Field Justify elements vertically aligns elements inside a column, e.g. to the left side.

or to the right side:

Field Weight influences desktop display order in a form. First desktop with lower weight will be shown. An example below:

After weight change:

Registering layer of type Row

Layer of type Row is the most common used type of a layer. Most often form elements are arranged in rows, which after that are put on main layer. When registering layer of type Row is essential to enter:

  • layer name (row)
  • layer title (in case of a row, the title isn't presented on a form, differently than in desktop of type Column)
  • parent layer (layer, in which defined row will be put) - is no selection was made then registered desktop will be put in main form layer

Field Weight influences order of displaying rows in a form. First will be shown layer with weight lower than registered one, then of higher weight (according to ascending weight). Elements marked with blue circle on above form influence the way of arranging elements in registered form (e.g. distance between elements, etc.). You can leave default values here.

Registering layer of type Group

If you want to group few layerss od form fields you can use layer of type Group to do so. Registering this layer in processed the same way as row registration does (click here, to check how to register row). This layer is different in terms of presented header (based on Title field) and all child elements of a group (layers and parent fields) are surrounded with a frame.

As you can see on image above, groups can be nested (as other types of desktop can).

Registering layer of typeGrid

Grid is a type of layer that allows putting child elements into multiple columns.

Field 1Field 2Field 3
Field 4Field 5 

Where number of columns is set - when registering layer - with a field Column.

Beside field Column when registering a desktop of type Grid the most important is to set:

  • layer name
  • layer title (will not be shown)
  • parent layer (layer in which defined grid will be placed) - no selection means setting registered layer in main form.

Grid works perfectly as a child layer for layer of type Group.

Registering a form field

To register a form field you can use following option: Resources->List of forms. After selecting right form you need to pick from menu option Fields:

After that we will be show list of fields defined for each form:

Pressing button New fields leads to opening new window to register a form field.

Registering field TextOnly

If you want to put on a form some kind on information text you can use field TextOnly.

On the form will be set text entered in Text field, which you can additionally personalize with CSS properties in field CSS Style. If you want to enter long text then you can use following icon: to edit in bigger window (check image above). Clicking this icon will show bigger window where you can input long text in more convenient manner.

Closing window will send entered text to appropriate field.

Effect of field registration of type TextOnly can be seen on a form below

Field Weight has the same meaning as for desktops (here you can read more on desktops), meaning that it sets order of fields that belong to one desktop.

Important!

If selected desktop is parent to other desktops, but also contains fields assigned to it, then first will be shown desktops according to weights and after that - field (in the same order rule).

Registering field DateField

Field of type DateField is used for entering data in format YYYY-MM-DD.

When registering it you can leave field Default value empty (in that case in a form as a default setting will be show current date) or:

  • enter specific date (e.g. "2013-01-01")
  • enter dynamic value e.g. code:date("Y-m-d",time()-3600*24) (one day shift) or e.g. code:date("Y-m-01") (start of a month)

Registered this way field will be displayed in a form as below:

Clicking on marked on an image calendar icon may ease with selecting different date. When changing it you can also use traditional lists.

Registering field TextField

Field of type TextField can be used to enter any value. When registering a field you should enter:

  • field name
  • whether filling field is mandatory
  • field's description (shown on form)
  • default value (same as with the field type DateField you can use command code:. Thanks to this form value can be dynamic, e.g. code:date("Y") - show current year.
  • length of a field (maximum number of characters that can be entered)
  • data format (set based on dictionary names FORMATS - if you lack certain format you can add it to mentioned dictionary - here you can know more about registering a dictionary)

Field Weight has the same meaning as in desktops (here you can read more about desktops) - it sets order of fields on one desktop. Field can be additionally personalized using CSS properties in field CSS Style.

Last two fields (Name of child field (linked) and Where clause for child field) can be used to define linking between registed field and other field in a form (value entered in first field influences displaying value in second field). Example of such a linkage can be found here. Field registered in example (image above) in a form looks like below:

Registering field TextFieldAC (autocomplete)''

Another type of field you can define in a form is TextFieldAC (autocomplete). This kind of field if different from regular TextField this way that after entering few letters/numbers full value is autocompleted from defined during registration source field (similar to Google search box).

Important!

In a single form you can register maximum of 5 fields of type TextFieldAC.

During registration of this field besides values you have to set as for regular field TextField you have to enter:

  • id of a field(pole Id field) - value selected from list - is there is more than one autocomplete field you need to choose value that come after previous one
  • data source (here you can learn how to define new data source) - CAUTION! Data source entered during registration is overridden with a source defined in a report, to which selected form will be assigned. So you can enter any source here, but if you just want to test field's behaviour it has to be source based on a database which constant table set in field Autocompletion - table
  • number of letters/numbers (field Autocompletion - table), after entering that number of characters autocompletion will become active
  • field name from table set in field Autocompletion - table
  • table name, of which data will be used
  • additional WHERE condition for table selected in field Autocompletion - table

Effect of registration field of this kind and it's usage presents below image:

Field TextFieldAC should be used when you choose from great number of elements, e.g. zip code selection. If number of elements is low it's advised using list of choice (field of type ListField).

Registering field RadioButton

In field palette you can also find field of type RadioButton that can be used when you want to pass at least two values to the report (in this field it's possible to define maximum number of 5 elements):

If form are visible values entered in fields Value of n and to report is pased number of selected field.

In presented above example after choosing B value, to report is going to be passed value 2. To present field in a form is advised using desktop of type Grid embedded in Group desktop (check image above).

Registering field CheckBox

When registering field of type CheckBox beside field name and description you should enter:

  • value - this is text presented on left side of a checkbox

If you want to set checkbox as selected () you should choose option Default selection. If in a form user sets checkbox as selected the to report is passed value 1. Below is presented field usage in example form:

The same as in case of other field position of a checkbox is decided by fields Weight i Layer.

Registering field ListField

When registering field of a type LiestField you need to enter:

  • field name
  • field description - it's value presented on a form
  • values dictionary - if you want to show date basing on your own dictionary you need to register if first (learn how to do it her)

Selecting field named Multiple choice available you enable choosing multiple values from a list at a time (field Size need to be set with a value greater than 1, e.g. 5)

Important!

When selecting fields from a list you need to keep Ctrl key pressed to select multiple fields at a time

Linked fields (AJAX)

In ProReports you can create such a form where between some fields there's going to be dependency (connection). This dependency is visible in a way where entering or choosing certain value in one field (parent field) will have influence on value displayed in other field (child field - linked field - is always linked with a list).

Important!

One parent field can be connected to multiple linked fields.

Linking choice lists

Here is instruction for creating connection (linking) between two fields:

  • parent field of type ListFieldA storing data from dictionary LST_WIEK - century (e.g. 20)
  • child (linked) field of type ListFieldZD storing data from dictionary LST_ROK - year (in format: YYYY)

Let's assume that mentioned dictionaries have been created. You want to achieve effect, where selection from first list will narrow down second list only to year in selected century.

Registering parent (master) field ListFieldA

Firstly you need to register parent field of type ListFieldA. From ListField it is different in a way that when registering it you need to select values of two fields:

  • name of linked field (child) - in this field you need to enter name of linked field ended with semicolon (;)(check image below)
  • WHERE condition for linked (child) field - it's part of WHERE clause that will replace original WHERE clause set when registering in linked (child) field. If in linked field following option in selected constant condition (valid with Ajax), then condition from parent field won't replace condition from linked field but is added to it.

In field WHERE condition for linked field you can use registered field's name in format %FieldName%.

Registering linked (child) field ListFieldZD

In second step you need to register linked field of type ListFieldZD where you have to set:

  • field name - it has to be the same as in parent field (linked field name)
  • field description - any description of a field (it's shown in form as a list header)
  • data source - points to data source from which list elements will be collected
  • list of fields - field name (or fields - max 3) from table that is used to fill list with data
  • tables - name of the table from which list's elements will be extracted
  • WHERE condition - initial WHERE clause (if field constant condition (valid with Ajax) has been chosen, then condition from parent field won't overwrite it, it will be added at the end instead)
8
Working presentation in a form

In effect of registering linked (child) fields we obtain following situation. Selecting from list Age number 19 will display on a list Year - Ajax from selected century (of course filled in dictionary LST_ROK - example has only year 1999):

Changing selection to 20 updates linked list (which is limited to values that are in dictionary):

Linking data entry field with selection list

In ProReports there is a possibility to link in entering data form TextField with selection list ListFieldZD. In that case entered value in field TextField has influence on ListFieldZD list content.

Registering parent field TextField

Registering parent field goes as registration of regular field of type TextField, the only difference is you need to fill two additional fields:

  • linked (child) field name - in this field you need to enter name of child field ended with a semicolon (;) (check image below)
  • WHERE condition for linked field - it's part of WHERE clause that will replace original WHERE condition set when registering in linked field. If in linked field you selected constant condition (valid with Ajax) - it's condition from parent field and it doesn't replace original condition from child field but it is added at the end of it

In field WHERE condition for linked field you have to use registered field name in format %FieldName%.

Registering linked (child) field ListFieldZD

Registering linked (child) field in this case is identical as in example above (Registering linked (child) field ListFieldZD).

Working presentation in a form

Thanks to linking fields, when entering value 19 in field Age (after entering you need to remove focus from that field - by clicking anywhere else) it updates selection list Year - Ajax:

Changing value of field Age on 20 will lead to automatic refreshing selection list Year - Ajax:

Registering field Button

From version ProReports v.3.1.29g-r10 you can register field Button. When registering this field you need to enter the following data:

  • name - attribute name in HTML
  • description - attribute value in HTML
  • action - with what kind of action will be linked to the key
    • btn_add - add one value from fields specified in the fields Values from fields to field specified in Associated with the field (only ListField)
    • btn_addmulti - add selected values from fields specified in the fields Values from fields to field specified in Associated with the field (only ListField)
    • btn_delete - delete selected values from field specified in Associated with the field (only ListField)
    • btn_up - move up selected value in field specified in Associated with the field (only ListField)
    • btn_down - move down selected value in field specified in Associated with the field (only ListField)
  • added option marked as selected - set checkbox to active if you want add selected values as selected to field specified in Associated with the field (only ListField)
  • CSS style - it gives you the ability to set individual style for the field, for example padding:2px;width:50px;

How can you use the new fields shown in the test form TestButton and TestButton1.


This page may have a more recent version on pmwiki.org: PmWiki:FormsRej, and a talk page: PmWiki:FormsRej-Talk.

Edit - History - Print - Recent Changes - Search
Page last modified on August 29, 2019, at 11:06 AM EST