Parameter Filters

Parameter filters allow you to have a click and collect experience when viewing Increment pages. Pages that use parameter filters can be customised based on three parameters: chain, date range and date aggregation. See how to use and integrate these parameter filters below.

[chain_name:chainname]

All tables on Increment have a unified schema that works across the supported chains. Therefore, the SQL query that pulls data for Ethereum can also pull data for any of the other chains - with no change to the code. The [chain_name:chainname] parameter filter enables viewers of your analysis to pivot metrics via the chains in the chain_name column.

;

Example

Lets assume you are trying to compare the daily transaction count for Avalanche, Fantom, Polygon, Optimism, and Arbitrum. Your query would look like the following:

SELECT date_trunc('day', signed_at) as date
       , uniq(tx_hash) as count
       , chain_name 
FROM blockchains.all_chains 
WHERE chain_name IN (avalanche_mainnet
                    , fantom_mainnet
                    , optimism_mainnet
                    , arbitrum_mainnet
                    , matic_mainnet
                    )
GROUP BY date, chain_name

The query above has no customizability. If you want to subtract or add new chains then you'll need to update the SQL. Updating the SQL can get extremely tedious if your page has multiple charts. Therefore, rewritten the query using the chain_name parameter filter.

SELECT date_trunc('day', signed_at) as date
       , uniq(tx_hash) as count 
       , chain_name
FROM blockchains.all_chains 
WHERE [chain_name:chainname]
GROUP BY date, chain_name

Then the user can select their desired chains in the drop down menu (see video).

[signed_at:aggregation]

The [signed_at:aggregation] parameter filter enables viewers of your analysis to pivot metrics via different date aggregations (e.g daily, monthly and yearly).

;

Example

Lets assume you are trying to calculate the transaction count for Avalanche but you want the ability to zoom in and out using different date ranges such as daily, monthly and quarterly. Instead of writing out the query 3 separate times and adding a chart for each date aggregation, use the [signed_at:aggregation] to dynamically change the aggregation from the page view.

SELECT [signed_at:aggregation] as date
       , uniq(tx_hash) as count 
FROM blockchains.all_chains 
WHERE chain_name = 'avalanche_mainnet'
GROUP BY date

Now the viewer can change the date aggregation depending on their use case.

[signed_at:daterange]

The [signed_at:daterange] parameter filter enables viewers of your analysis to pivot metrics via different date ranges (e.g last 30 days, last quarter and this year).

;

Example

Lets assume you are trying to calculate the transaction count for Avalanche but you want the ability to zoom in and out using different date ranges such as this quarter, the last 30 days and this year. Instead of writing out the query 3 separate times and adding a chart for each date range, use the [signed_at:daterange] to dynamically change the date range from the page view.

SELECT date_trunc('day', signed_at) as date
       , uniq(tx_hash) as count 
FROM blockchains.all_chains 
WHERE chain_name = 'avalanche_mainnet'
AND [signed_at:daterange]
GROUP BY date

Now the viewer can change the date range depending on their use case.