Skip to main content

Query Editor

Business Intelligence

Updated over 3 weeks ago

The Query Editor allows you to try out 4GL queries against the Coins ERP+ database and sample the data returned. This function can be useful to test queries before being used in reports or enquiries.

Query Editor Screen

To use the query editor simply enter the query, and (optionally) any fields required - space separated - and click Run. The system will return an error if any part of the query is incorrect – and a sample of data if the query compiles OK.

If the fields section was left blank, all fields will be displayed. If field names were specified, only those fields will be shown.

Query Editor Results

Field

Description

Data Set

A Data Set definition can be entered here to display the information created in the data set (No query or fields are required for this).

Condition Field

A function that determines whether a record should be included or not. The function returns a logical value: yes to include the record, no to exclude it.

Maximum Rows

Allows the query to fun faster by only displaying a maximum number of rows per query. 10.23 onwards, this defaults to 10

Extra Parameters (10.23 onwards)

Where a dataset has been specified, this field allows entry of of parameters (URL) that are needed by the dataset query.

e.g.

The parameterised fields are so that you don't have to 'hard code' queries in the dataset to get it to run in the query editor – particularly if there are date replacements etc with fields like {RS_glp_fdate__2}. Or another useful reason for using these parameters is so that you can test results in a efficient way for instance: if you have a query on the dataset which reads:

FOR EACH jc_job WHERE jc_job.kco = {kco} {jobSelect}

You could call the dataset from within the query editor and in the parameters say jobSelect=and jc_job.job_num = 'XXXX' (where XXXX is a vailid contract number).

That way the dataset would run but for only contract XXXX - This is good to save time in checking the validation of fields in the dataset as you don't have to wait till the whole dataset evaluates prior to getting a response back.

If you have more than one {} replacement in your dataset then you would separate the parameters with a & symbol Eg: Dataset query might read :

FOR EACH jc_job WHERE jc_job.kco = {kco} {jobSelect},

EACH jc_costcode of jc_job WHERE TRUE {jccSelect}

You could call the dataset from within the query editor and in the parameters say jobSelect=and jc_job.job_num = 'XXXX' &jccSelect= and jc_costcode.jcc_cc = 'YYYY' (where XXXX is a vailid contract number and YYYY is a valid Costcode).

DB Fields defined as array in the Database Enquiry such as avm_add[4] can be entered without the index of elements to display all elements (previously the element would need to be specified such as avm_add__1, avm_add__2 etc.)

Query Editor Results - Array Fields

Wildcards can be used in β€œFields” on Query Editor screen to mask fields

Query Editor Results - Wildcards

Search and Replace

Clicking Search allows you to search for a character string within the Query. This is particularly useful for large queries.

If found, the string will be highlighted within the query.

Clicking Replace All will prompt for the search string to be replaced

Enter the required string and click Enter. The system will then prompt for the replacement string.

Enter the replace ment string and press Enter. The system will then replace all instances of original text with the replacement string.

Exporting from the Query Editor

To export the query and associated results to excel simply click Export . The query editor will then open the data set in a new screen. This information can then be exported to Excel by right-clicking anywhere in the data table.

The spread sheet created will contain the appropriate query and links to coins so that the data can be refreshed at any point.

Saving Queries in Query Editor (10.27)

To prevent the need to keep re-typing regularly used queries, save and load options are available as of v10.27 and are located at the top of the Query Editor page.

  • Once you have set up your query and selected the required fields, in the Stored fields, specify a name for the query and a description to further identify it.

  • Click Save.

  • The Query will now be stored and can be retrieved at any time by running Query Editor, specifying the Query name and clicking Load button.

  • To delete a saved query, specify the name and select the Delete button.

  • The full list of stored queries may be viewed from the new Queries option from the Reporting and BI Utilities Menu.

This screen will allow the creation, deletion and maintenance of the stored queries.

To see the results of the queries, you will need to return to Query Editor and Load the appropriate query.

Did this answer your question?