Referencing Catalog Assets within a Query

Using Parameters in Catalog SQL

We consider it as one of the most innovative Aginity features. Below, you will find a helpful insight about the basic syntax required to call Catalog items from within SQL statements.

In this example, we use a parameter within a Catalog item called CitySelect.

  1. Here is the code you need for the Catalog. Note that the highlighted line has the parameter in it.

1

2

3

 SELECT *

 FROM addresses

 WHERE city = $city;

  1. To call it from the query panel, issue the following command.

1

 @{/My Catalog/CitySelect}

Note the highlighted reference to the object in the Catalog.

  1. This is the code that Coginiti will pass to the database.

1

2

3

 

 SELECT *

 FROM addresses

 WHERE city = 'Chicago';

🔎 NOTE: Upon execution of the command, Coginiti will ask you to supply a parameterized value.

 

How to Create Reference and What Does it Mean

Creating a Reference means that you can take a part of the code from some query and insert it in another one without the need to copy-paste. You just refer to it via a special link. The most important benefit of this feature is that when you edit something in a part of code you referred to, Coginiti will automatically update its SQL in all catalogs that use it. 

  • You can insert a reference to a Catalog directly in a query. Right-click on the needed query Choose Insert Reference at Cursor.

mceclip11.png

  • Or refer to a Catalog through Aginity Discovery Panel.

🔎 TIP: To know more, visit our Discovery Panel guide.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request