Scroll

Introduction to Automation Scripts

Introduction to Automation Scripts

Follow

 

Summary This article the new scripting language and interface in Analyse which allows users to run a script which builds a portfolio.
Applies to Askia Analyse.
Written for Data Processors.
Keywords Scripted tables; Super-portfolio; Automated scripts, Auto Analysis; Tab definition; Chapter; Grouped responses; Calculated responses; Update portfolios; Command line; Clone; Coding question; Developed question; Visible during data entry; Calculated question; QuestionArray; TabDef; Portfolio; PortfolioItem; SubPopulation; Profile; ProfileItem; ProfileQuestion; Rows; Columns; Edges; Global Tab Template; Scaled values.

 

Getting started

Firstly, you'll need to ensure you're on the latest version of Analyse 5.5.3 for all discussed functionality and examples to work.

There is a new top menu, 'Automation', where we open the new script interface:

mceclip4.png  mceclip3.png

To see which keywords are applicable to this new scripting language please review the summary tables in our Askia analyse Script Appendix. (See columns named 'Automation scripts').

The idea when writing a script is that each script is generic i.e. there should be no references to shortcut names. Instead we use:

 

1. Various keywords to identify different types of questions e.g.

IsCalculated - isolates Calculated questions

mceclip6.png


IsCoding - isolates grouped response, grouped value and change level questions

mceclip5.png


IsDeveloped - isolates all developed questions in a loop

mceclip7.png


IsVisibleDuringDataEntry - isolates all questions which have the option 'Visible during data entry' selected in askia Design

mceclip8.png

 

'Type' of the variable  - isolates questions by their type e.g.

 myQuestion.Type = "chapter"

 

2. 'Tags' Defined in askia Design to classify groups of questions or responses for particular analysis

Tag menus in askia Design:

mceclip9.png  mceclip10.png

Question tags:

mceclip13.png

Response tags:

mceclip12.png

Questions and Responses are permitted to have multiple tags assigned to them.

mceclip16.png

You can also set a tag to several questions or responses in one go as shown below:

mceclip14.png

 

For the purposes of introducing Automation Scripts, shortcut names are included in one or two of the simplest examples (solely for ease of explanation) before going on to talk about tags and question types.

 


 

Examples

The examples in this article can be tested on the .qes file here. It has all the question types and tags required to run the example scripts and demonstrate the functionality. In order to run the the same scripts on your data files, you'll need to add tags to your .qes or .qew. If the tags you add have different names, you'll need to update tag references in the scripts provided.

Remember that all these examples can be run from the command line using the /"automate:" parameter e.g. 

Analyse.exe  "c:\Qes\ex.qes" /"automate:c:\Scripts\myScript.txt"

 

Let's begin!

To use any of the examples, click on the screenshot to download the script in a .txt file. Then in Analyse, go to the Automation menu > Open and select the file.

  1. Add one question to rows and columns
  2. Add a chapter to the portfolio first, then add the above tab definition to it
  3. Add two empty tab definitions in each of two chapters
  4. Add ten empty tab definitions in each of eight chapters using for-loops
  5. Add all questions containing data to the rows of a single tab definition i.e. create a simple hole-count
  6. Use tags to add the demographics questions to the rows
  7. Deselect Responses for Profile Questions
  8. Update settings in the General tab of an existing portfolio and save it as a new portfolio
  9. Create a new sub-population & select specific developed questions
  10. Add groups, calculated responses and scaled values using clones
  11. Adding groups and calculated responses using script
  12. Creating summary tables for all loops in your data file 

 

 

Example 1 - Add one question to rows and columns. 

mceclip20.png

 

 

Example 2 - Add a chapter to the portfolio first, then add the above tab definition to it.

mceclip21.png

 

 

Example 3 - Add two empty tab definitions in each of two chapters

mceclip23.png

 

 

Example 4 - Add ten empty tab definitions in each of eight chapters using for-loops

mceclip25.png

 

 

Example 5 - Add all questions containing data to the rows of a single tab definition i.e. create a simple hole-count

mceclip26.png

 

 

Example 6 - Use tags to add the demographics questions to the rows

mceclip27.png

 

 

Example 7 - Deselect responses of questions added by tag to a profile.  

mceclip0.png

 

 

Example 8 - Update settings in the General tab of an existing portfolio and save it as a new portfolio. 

mceclip3.png

N.B. We loop through portfolio.items[] so we can apply the required settings to every tab definition in the portfolio.

Existing portfolio vs updated portfolio:

mceclip1.png  mceclip2.png

Click on the 'Existing portfolio' image to download the xml.

 

 

Example 9 -

  • Create a new sub-population from scratch and apply it to your tab definitions
  • Use chained / nested tags to select specific developed questions from your loops to your rows
  • Add all non-numeric Demographics questions to your columns

mceclip4.png

mceclip5.png

 

 

Example 10 - Add groups, calculated responses and scaled values using clones:

mceclip8.png

We check which question shortcut falls into which tag category; NPS, 5pt scale or 7pt scale. Then we apply the correct clone to all filtered questions and put them in the rows. Click on the screenshot below to download all the clones (and the .qes file used to create them).

mceclip6.png

 

 

Example 11 - Adding groups and calculated responses using script.

Click the animation below to download both example script files demonstrated.

10.gif

 

 

Example 12 - Creating summary tables for all loops in your data file.

mceclip10.png

  • The child question of the loop goes in the rows
  • The next parent (loop) variable goes in the columns
  • All remaining parent (loop) variables go in the edges
  • Apply a global tab template which has the 'Nest edges' options selected for loops of three or more parent levels.

mceclip12.png

 

Have more questions? Submit a request

Comments