QQ - How do I add a report created using Discrete Statistics to script?
  • 1 Minute to read
  • Dark
    Light
  • PDF

QQ - How do I add a report created using Discrete Statistics to script?

  • Dark
    Light
  • PDF

Article summary

Instead of using Discrete Statistics to create the report, use the Set As Measure and Category option in the Multi Field Statistics report.

Consider the following table: It has 2 fields:  

  • PetalWidth 
  • Species 

An instant box plot of PetalWidth by Species can be created by dragging and dropping PetalWidth on top of Species.   This will bring up the context menu, from which Discrete Statistics can be selected.   A Multi-Field Statistics Chart will open up, with a row entry created for each value in Species.

However, this report cannot be recreated in script if the number of values or value names in Species or PetalWidth could change.

To create a report that will dynamically respond to changing data in the source fields, use the following method:

  1. Open the Multi Field Statistics report
  2. Drop PetalWidth onto the setup grid and choose Add Field
  3. In the setup grid, drop Species on top of PetalWidth, and choose Set as Measure and Category.
  4. Click the green Run arrow
  5. The existing rows will disappear from the setup grid, but a result grid and chart will be created.


This report can now be added to script, and will dynamically recreate for the contents of the two fields that have been analysed.

Report Definition
The script entry for a report that has been created using this method will contain the following:

 
"measure": "IRIS.PetalWidth",

"categoryField": "IRIS.Species",

"flip": false




Was this article helpful?