Building Custom Visualizations for Apps and Scripts

Teradata® AppCenter User Guide

brand
Analytical Ecosystem
prodname
Teradata AppCenter
vrm_release
1.8
category
User Guide
featnum
B035-1111-039K

User, Administrator

AppCenter supports upload of custom visualization code for apps that run once or on schedule and SQL scripts. To create JavaScript code with visualizations that you can upload as a bundle file to your SQL app or script, do the following:

  1. In an app or SQL script, run any SELECT statement. You get JSON data in the following format:
    {  
       "queueDuration":1,
       "queryDuration":175,
       "results":[  
          {  
             "resultSet":true,
             "data":[  
                {  
                   "name":"username1",
                   "address":"santa clara"
                },
                {  
                   "name":"username2",
                   "address":"san jose"
                }
             ],
             "rowCount":12,
             "rowLimitExceeded":false
          }
       ]
    }
    
  2. In the visualization code, add $$$$$$ where you want the data you extracted to be inserted at runtime. For example:
    <html>
    	<head>
    		<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
    		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    	</head>
    	<body>
    		<script type='text/javascript'>
    	  $(document).ready(function() {
    		 var data = $$$$$$;
    		 $('div p').text(JSON.stringify(data)); //converting the data to string for display
    		 });
    	</script>
    		 <div style="width: 100%; height: 100%; width: 100%;">
    			  <p></p>
    		 </div>
    	</body>
    </html>
  3. In Settings for your SQL app or script, select Custom (Upload) to upload the JavaScript bundle file.