- Print
- PDF
Dialog setup is a Lasernet Connector function that allows you to customize the dialog that appears when you run a Lasernet report. If you have a custom Query with a Form link, you can use Dialog setup to customize the behavior and options of the Lasernet button when it is clicked. Examples of behaviors you can customize with Dialog setup include adding parameters to the dialog that enable the user to make selections or add notes when printing the report and adding Default ranges so the report recognizes the currently selected record and runs on that record.
Dialog Setup Locations
Dialog setup can be found in two places:
Lasernet > Common > Reports, on the Action pane of the Lasernet Query.
Lasernet > Common > Reports, in the Form link of a Lasernet Query report.
We will review the Dialog setup found on the Action pane for the Lasernet Query report. This Dialog setup controls the dialog the user sees when they run the Query report from the Run Report button in the reports form.
Dialog Setup Settings
When you select Dialog setup you will see a form with a Default ranges button and three fast tabs: General, Parameters, and Details.
The General tab contains the following settings:
Execution: Indicates how the report dialog shall be used when running a report.
Set focus: Selects the control that is supposed to be selected when the form opens.
Submit when modified: Automatically clicks OK after a field modification.
The Parameters tab enables you to add and customize the parameters on the dialog.
When the Show checkbox is selected, the parameter will show as an option on the dialog for the user to modify if needed.
Control name is a Language text that allows your parameters’ name to translate automatically to the user’s language.
Default value allows you to hardcode a value for this parameter or use the Expression editor to dynamically select the default value.
Range allows the input in the parameter field to be read as a Range rather than a single value.
The Load Instruction column allows you to determine how the parameter field will load when the dialog pops up at a report run:
From last value: The value used in the dialog on the last run of this report will load.
From default – fixed: The value indicated in the Default value column will load and cannot be changed by the user running the report.
From default: The value indicated in the Default value column will load, and the user can change it.
Clear: No value will load.
Lastly, the Details FastTab allows you to set properties on the Parameter that is currently selected.
The Lookup group includes two fields: Extended data type name and Enum name. If an extended data type or an Enum name exists in the system corresponding to the parameter you have added, selecting it here creates a dropdown on the parameter in the dialog for the user to select.
Extended data type name: name of an extended data type in the AOT.
Enum name: name of enum in the AOT.
The Default Ranges button on a Dialog setup opens the Default query ranges form for the report. This form allows you to set up ranges and filters for report fields. On a Dialog setup, you can use Default ranges to assign Parameter values to fields in your report. This gives the user running the report the ability to filter and control the output of the report.
Example of Dialog Setup Configuration
Prerequisite
We have created a custom Query report called CustomerInvoiceReport.
Navigate to Lasernet > Common > Reports, select CustomerInvoiceReport, and select Dialog setup from the Action pane.
Select Default for Execution, leave Set focus blank, and toggle the Submit when modified button to No.
Create a new Parameter
To add a new parameter, follow these steps:
Click New and provide a Control name.
Select the Show checkbox, choose a Default value, and select From last value for the Load instruction field.
Set Up a Default Range Using a Parameter
To set up a Default range using a Parameter, follow these steps:
Click Default ranges.
Add a line for table CustTable and field AccountNum.
Scroll to the right and select the Expression editor button.
The Expression editor will open.
In the Selected value field, click the dropdown and select Parameter.
Click the dropdown again, and you will now see all the Dialog Parameters available for selection.
Select the new parameter and click OK to close the Expression editor.
Click OK in the Dialog setup to close it.
Select Run report from the Action pane.
You will now see the new parameter. You can type in a value before clicking OK to run the report.
The report will run using the value you have entered in the dialog as a filter on the corresponding table.
Use Extended Data Type
To use the Extended data type, follow these steps:
Open the Dialog setup again and select the new parameter.
In the Details FastTab, open the dropdown for Extended data type name, select CustAccount, and click OK.
From the Action pane, select Run report. The dialog will appear.
Click the dropdown arrow for the Parameter, and you will now see a selection of Account numbers in the system.
Select a value from the dropdown and click OK to run the report.
The report will run using the value you have selected in the dialog as a filter on the corresponding table.
Use Custom Enum Fields and Single Select
You can customize the dropdown list the user sees on a Dialog setup by using custom Enum fields. To use the custom Enum fields, follow these steps:
Open the Dialog setup again and select the parameter.
In the Details FastTab, ensure the Extended data type and Enum name are blank, as we will create custom Enum fields.
In the Default value field, define your custom Enum fields by typing in each field in the following format: [Name]#[Value].
The following image shows the Customer account name as the Name and the Account number as the Value. Each option is separated by a comma.
Define the Multiple value type. Select Single select to limit the user to selecting one value and click OK.
From the Action pane, select Run report. The dialog will appear.
Click the dropdown arrow for the Parameter, and you will now see a selection of the Account number values you defined in the Dialog setup.
Select a value from the dropdown and click OK to run the report.
The report will run using the value you have selected in the dialog as a filter on the corresponding table.
Use Multiple Values Field
In the previous section, we used custom Enum fields with Multiple value type Single select. Multi-select allows the user to select more than one option.
To use the custom Multi-select, follow these steps:
Open the Dialog setup again and select the parameter.
In the Details FastTab, set the Multiple value type to Multi-select and click OK.
From the Action pane, select Run report. The dialog will appear.
Click the dropdown arrow for the Parameter. You will now see a selection of the Account number values you defined in the Dialog setup with the option to select multiple values.
Select multiple values and click OK to run the report.
The report will run using the value you have selected in the dialog as a filter on the corresponding table.
Use a Range and System Functions
You can use user input to filter on a range of values for your report. For example, when running a report on a date range. It is also possible to filter on a UtcDateTime field value using System methods.
To achieve this by using system methods and the Expression editor, follow these steps:
Open the Dialog setup and add two new parameters. One for the From date and one for the To date.
Add an extended data type name for each of the newly added parameters. Use FromDate for the From parameter and ToDate for the To parameter.
Select Default ranges, add the table and relevant date field that will be filtered, and open the Expression editor.
Add the following system functions unless they already exist. Select Add system function, and find the Class name and Method name, and click OK to add these to the list of available functions:
Global:: datetobeginUtcDateTime(..)
Global:: datetoendUtcDateTime(..)
DateTimeUtil:: getUserPreferredTimeZone(..)
Create the following expression: datetobeginUtcDateTime ( Parameter.From , getUserPreferredTimeZone( ) )+ ".." + datetoendUtcDateTime ( Parameter.To ,getUserPreferredTimeZone ( ))
Warning
Results may vary depending on whether a user time zone is specified or not.
Click OK to save changes and close out of the Dialog setup. From the Action pane, select Run report. The dialog will appear.
Select the calendar icon, and you will now see the option to select a date. Populate the From and To parameters, and run the report.
The report will run using the values you have selected in the dialog as a filter on the corresponding tables.
Warning
When running the report an error is thrown back: ‘Error in Query wizard - Lasernet can't display SQL call that has expression in it and throws an error.’
This is just a display error, not a functional error.