--- title: "QQ - How do I add a report created using Discrete Statistics to script?" slug: "qq-how-do-i-add-a-report-created-using-discrete-statistics-to-script" updated: 2022-09-16T13:02:37Z published: 2022-09-16T13:02:37Z canonical: "docs.datajet.app/qq-how-do-i-add-a-report-created-using-discrete-statistics-to-script" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # QQ - How do I add a report created using Discrete Statistics to script? 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:![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1663332270120.png) 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. ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1663332660547.png) 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. ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1663333145866.png) This report can now be added to script, and will dynamically recreate for the contents of the two fields that have been analysed. Report DefinitionThe script entry for a report that has been created using this method will contain the following: "measure": "IRIS.PetalWidth", "categoryField": "IRIS.Species", "flip": false