Skip to end of banner
Go to start of banner

Data Table from SQL Query

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

Before using the data table custom field, configure it as described on the Data Table Configuration page.

For this example we used a dynamic SQL script as a data source to retrieve all data from a product table based on the value of another custom field. So the configuration for our custom field looks like this:

Where {customfield_10001} represents a free text custom field which will be used for filtering the product name.

After the field is configured, when you view, create, edit an issue, or transition it, the data table custom field is populated with the values retrieved from running the sql query with the given parameter taken from issue.

Every time the parameter custom field changes, the query is re-executed and the grid displays updated results. Issue standard fields can also be used as dynamic parameters for the query. For more details see the Dynamic Query (SQL) page.

If the field is configured without the dynamic parameter in the sql (without the WHERE clause) it would always retrieve all results from the table, as shown below:

You can change the table headers by specifying columns alias in the sql query. For our example, you can change the sql query to display the columns names as Id, Name, or Description. You can also specify an order by clause, to display the data in the table grid ordered by the desired column:

SELECT P_NAME AS Name, P_DESCR AS Description, P_ID AS Id FROM PRODUCT ORDER BY P_NAME

After saving the configuration with the modified sql query, the data table custom field will display our data like this:

That's it.

  • No labels