Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Data Access
Created by Guest
Created on Oct 27, 2020

Define visualization view using custom SQL

Spotfire automatically generates SQL for in-db calculations based on the users visualization definition. This is very powerful when it works, but it prevents power users who are familiar with SQL from creating more complex SQL statements such as:

SELECT
jobs.job_title AS "jobs.job_title",
CAST(EXTRACT(day from CAST(CONVERT_TIMEZONE('UTC',
'America/New_York', sysdate ) AS TIMESTAMP) - CAST(CONVERT_TIMEZONE('UTC',
'America/New_York', jobs.created_at ) AS TIMESTAMP)) AS BIGINT) AS
"jobs.days_job_age"
FROM marts_tibco_poc.jobs_with_address AS jobs
WHERE ((jobs.client_code LIKE '%' OR (jobs.client_code IS NULL))) AND
((((jobs.created_at ) >= ((CONVERT_TIMEZONE('America/New_York', 'UTC',
DATEADD(week,-13, DATE_TRUNC('week',
DATE_TRUNC('day',CONVERT_TIMEZONE('UTC', 'America/New_York', GETDATE())))
)))) AND (jobs.created_at ) < ((CONVERT_TIMEZONE('America/New_York', 'UTC',
DATEADD(week,14, DATEADD(week,-13, DATE_TRUNC('week',
DATE_TRUNC('day',CONVERT_TIMEZONE('UTC', 'America/New_York', GETDATE())))
) ))))))) AND (jobs.posted_at IS NOT NULL) AND (CASE WHEN jobs.closed_status = 1
THEN 0
WHEN jobs.open_status = 1 THEN 1
WHEN jobs.folder ILIKE '%active%'
AND jobs.folder NOT ILIKE '%not %'
AND jobs.folder NOT ILIKE '%inactive%' THEN 1
ELSE 0
END) AND ((jobs.client_code LIKE '%' OR (jobs.client_code IS NULL)))
GROUP BY 1,2
ORDER BY 2 DESC
LIMIT 25

In order to do something similar data has to be imported into Spotfire which may require more processing power than what's available. Ideally Spotfire should automatically generate queries from the UI, but allow power users who have the skills to write their own SQL when it makes sense.

  • Attach files