Estimated Completion Time: 20 Mins
In this two part tutorial we will show you how to read and manipulate alerts from the dashboards testing data service. This service can aid development by providing simulated alert data to design and develop you solution with. Once you have finished development switching to a live data feed is usually quick and easy to do. In part 1 we will focus of connecting to the alert data and displaying it on the screen. Part 2 will build on this tutorial by performing analysis and formatting of the alerts before displaying them. So let’s get started. You will first need to Login to the dashboard builder to start the tutorial.
Step 1 – Connect to the alerts service
Add a dynamic text box widget to the dashboard using the new widget button in the bottom left hand corner of the dashboard builder. Locate and press the spanner icon to edit the widget. While inside the edit properties dialog locate the Chart Data Source property and paste the following code snippet into the property box. While still inside the edit properties dialog locate the Data Source Type drop down and assign it to XML.
Note: we are fetching only 15 alerts.
Step 2 – Display the Title Text
Continue to scroll down and locate the Chart Template property. In this property paste the following code snippet to display the title text. Now scroll down and press update to save and close the dialog to see the results.
Step 3 – Create a table for the Alerts
Once again locate and press the spanner icon for the Dynamic Text widget and locate the Chart Template property. In this property append the following code snippet at the bottom after the snippet from Step 2. This will create the table for the the alerts. Note: Each “th” line in the code adds a new column to the table. The classes c1-c7 can be used later to style the table. Now scroll to the bottom and press update and then close the dialog.
Step 4 – Populate the table with the alerts
Finally you need to paste this code snippet after the snippet entered in step 3. Each “td” line in the code adds data to the table. The code snippet uses Freemarker templating language to store the alerts in a variable called “a”. It then loops all the data adding a row to the table for each of the alerts. We cover more on how to use freemarker templating in later tutorials. Again save by pressing update and close the to see the results.
That’s all done!.Please enjoy your alert table. Now be sure to continue to Part 2 where we will see how to apply some nice formatting to our alerts table!
TIP: You can see the raw XML testing alert data
Advanced users can may want to access the test alert web service directly from the NetNow home menu system. Look under Web Services -> TestAlert you where you can browse the raw XML data that gets return to the dashboard from the web services.
For extra information, guidance and troubleshooting consult: