ResetCustomSQL (Method)

Applies To:

QuerySection object

Description:

Resets the original SQL statement before processing and has the Custom SQL window open in a query. The CustomSQLFrom (Method) , CustomSQLFrom (Method) , and ResetCustomSQL (Method) correspond to the edit SQL functionality in the Custom SQL dialog.

Note:

To use the Custom SQL feature, ensure that the query’s data model has one table. If no table exists, “Script(x):uncaught exception:Invalid String” displays in the Console.

Syntax:

Expression.ResetCustomSQL()

Expression Required:

An expression that returns a query object

Example:

This example sets the FROM and WHERE clauses, processes a query, and restores the original SQL statement:

//Set the FROM clause, Set the WHERE clause, PROCESS, and then RESET SQL
ActiveDocument.Sections["Query"].Process()
ActiveDocument.Sections["Query"].CustomSQLFrom("FROM From.Sales_Fact, From.Periods, From.Products") ActiveDocument.Sections["Query"].CustomSQLWhere("WHERE (Periods.Day_Id=Sales_Fact .Day_Id AND Products.Product_Id=Sales_Fact.Product_Id) AND (Periods.Quarter='Q1')")
ActiveDocument.Sections["Query"].ResetCustomSQL()