0

Postgres query:

SELECT  "KPMID",
   "CustomerID" as "cust_id::multi-filter",
   "KPM_Name",

   "Report_Period" as "rep_id::multi-filter", '<input type="text" ng-model="$select.search"/>'
   "Actual",
      CASE WHEN "TrendCode" = 'R' THEN '<img src="http://34.213.131.167/images/red.png" height="20px" width="100px"/>'

    WHEN "TrendCode" = 'Y' THEN '<img src="http://34.213.131.167/images/yellow.png" height="20px" width="100px"/>'

   ELSE '<img src="http://34.213.131.167/images/green.png" height="20px" width="100px""/>'
   END 
   "TrendCode",
   CASE WHEN "CStatusCode" = 'R' THEN '<img src="http://34.213.131.167/images/red.png" height="20px" width="100px"/>'
   WHEN "CStatusCode" = 'Y' THEN '<img src="http://34.213.131.167/images/yellow.png" height="20px" width="100px"/>'
   ELSE '<img src="http://34.213.131.167/images/green.png" height="20px" width="100px""/>'
   END 
   "CStatusCode",
   CASE WHEN "OutlookCode" = 'R' THEN '<img src="http://34.213.131.167/images/red.png" height="20px" width="100px"/>'
   WHEN "OutlookCode" = 'Y' THEN '<img src="http://34.213.131.167/images/yellow.png" height="20px" width="100px"/>'
   ELSE '<img src="http://34.213.131.167/images/green.png" height="20px" width="100px""/>'
   END 
   "OutlookCode" FROM public."KPMDataReport";

Output:

output

Two dropdowns are being displayed by executing the above SQL query, my requirement is to get the query executed on click of a button. So, how could I achieve this using redash tool.

If this is not possible at all through redash, then how to embed a JavaScript code as a part of SQL query and get this done. Redash instance is running on aws.

Vijay Rajagopal
  • 47
  • 1
  • 10
  • I couldn't work out from the redash site in under 10 seconds whether it supports pull-on-demand functionality. To use javascript you need some kind of API for it to talk to. – Nick.Mc Aug 04 '17 at 06:54
  • So, how do i call api to get the javascript code running on redash instance. – Vijay Rajagopal Aug 04 '17 at 07:00
  • I explained badly... javascript needs to use an API (application programmers interface) which needs to be exposed by redash in order to control redash. The two pieces you need for this are: 1. redash to expose an API which can be called by javascript; 2. If javascript needs to grab data, you'll need a server side API that serves that data up. Step 1 for you: find out what kind 'javascript automation' redash provides, and whether it provides a javascript API – Nick.Mc Aug 04 '17 at 07:38

0 Answers0