How to set parameters for SQL Query tool report

By | February 28, 2024

In Sage X3, we may come across a situation where we need to create SQL query tool by adding fields from the table.

There was one requirement from one of our clients to add parameters (filters) for the SQL query tool in the criteria tab.

In this blog, we will explore the process of assigning parameters to the SQL query tool based on client-specific requirements. So, we have added two parameters, ‘From Date’ and ‘To Date’.

We will see this functionality in detail in this blog:

Path>>setup>>Usage>>Reports>>SQL query tool

New Stuff: How to solve Error: “@X3.TRT/SUBSDHA$adx (2612) Error 6 : Variable Non-existent GLBDOCDAT” in Sage X3

Create SQL query
Create SQL query

Initially, formulate a SQL query in accordance with the client’s requirements. When incorporating parameters into the SQL query, ensure to enclose the parameter number within %% symbols as shown in the above screen shot.

For Example:
select * from SINVOICE where SINVOICE.INVDAT_0 between %1% and %2%

Path >> setup >> Usage >> Reports >> SQL query tool >> Parameter

Set Parameter Description, Datatype, and Default Values
Set Parameter Description, Datatype, and Default Values

Navigate to the Parameters tab and add the necessary parameters, specifying the desired data type. If a default value is needed for a parameter, enter the default value in the ‘Default’ column.

We have added ‘Date From’ and ‘Date To’ to the Parameter column, assigning a default value using the current date$ function.

Validate and run query
Validate and run query

After adding the parameter, click on the ‘validate’ button to validate the query, and then click on the ‘Run‘ button to execute it.

Path : Path >> setup >> Usage >> Reports >> SQL query tool >> Run button

Criteria button
Criteria button

Click on the ‘Criteria‘ button.

Popup for Parameters
Popup for Parameters

So, in conclusion, we have successfully added parameters to this query tool. Now, users can manually enter the required parameters, click on ‘Ok,’ and filter the query according to their specific needs, thereby enhancing the flexibility and usability of the report.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.