- Definition
- Examples
- 1. Import askiaweb interview data
- 2. Import PKD data
- 3. Import Dimensions data (here triple-S)
- 4. Import SAV data
- 5. Import Triple S XML data
- 6. Merge interviews
- 7. Delete interviews
- 8. Compact and Repair
- 9. Transform into loop
- 10. Transform into multiple
- 11. Export the datamap to a text file
- 12. Import fixed length ascii data
- 13. Export fixed length ascii data
- 14. Export delimited ascii data
- 15. Export delimited ascii data stored in SQL
- 16. Export delimited ascii data stored in the inverted files
- 17. Export SAV
- 18. Export Triple S
- 19. Export multimedia files
- 20. Merge files using an ID
- 21. Import from Excel / Access
- 22. Import XML interviews
- 23. Stacked Export
- 24. Export SAV excluding questions
- 25. Detect & create loops and multiples using regex
- 26. Run a verification script
- 27. Opening a live survey
- 28. Create new data column on-the-fly in delimited ascii export
- 29. Select questions to export based on their properties using `/questionselection`(from v5.6.0)
- 30. Filter your data exports on string values using the "/additionalfilter:" command
- Applying Commands to Multiple Files Quickly
- Use of batch files (with one command split across multiple lines)
- Return error codes
askiatools can be used via Command line which is extremely useful with askiavista's Scheduled Tasks.
Definition
Here the list of arguments which can appear in the command line to start askiatools:
Parameter | Type | Description | Value |
{None} | String | Path of survey file, QES, specificed between quotes " | |
/type: | Integer | Defines the type of survey and/or data | 0: QES 1: in SQL Server (Legacy format) 2: inverted data format 3: Data stored in SQL Server (new SQL format) 4 : Data stored in WebInterviews SQL database |
/url | String |
CcaWebAPI URL to use when opening a live survey. /url:"https://MyServer/CcaWebAPI" [from v5.4.9.0] |
|
/username | String |
Supervisor's user name used to connect the CcaWebAPI when opening a live survey /username:"Supervisor" (used by /url) [from v5.4.9.0] |
|
/password | String |
Supervisor's password used to connect the CcaWebAPI when opening a live survey /password:"Supervisor pwd" (used by /url and /username) [from v5.4.9.0] |
|
/webtable | String |
Indicates the webinterview SQL table to use when exporting data from WebInterviews (used by /type:4) |
/addcolumn | String | String that specifies which column should be added on the fly. | |
/additionalfilter | String | String that specifies which interviews are selected. | |
/after | String | Indicates that only interviews whose start interviews is after the indicated string are selected./after:2019-10-01 |
|
/alwayspoint | - | Flag used to make sure the decimal point is always `.` and not a comma. | |
/analyseincompletes | - |
Flag used to request a report on drop outs : http://analysishelp.askia.com/incomplete_data_analysis The following parameters can be used : |
|
/before | String |
Indicates that only interviews whose start interviews is before the indicated string are selected. /before:2019-10-01 |
|
/closeddk | Value |
Parameter indicating the value of DK for closed questions /closeddk:999
|
|
/closedtype | Integer | Value that indicates how closed modalities are exported. | 1 : order 2 : caption 3 : entry codes 4 : entry codes numeric |
/completes | - | Flag used to indicate if the selection should include the completes interviews | |
/completesonly | - | Flag indicating that only completed interviews should be imported. (used by /mergeinterviews) |
|
/createclosed | - | Flag used to transform a numeric or open-ended question into a closed question by finding all values. The following parameters can be used : /questions, /inverted, /questioncaption, /shortcut, /delete, /nohide |
|
/createloop | - | Flag used to transform a set of questions into a loop. The following parameters can be used : /questions, /inverted, /modalities, /questioncaption, /shortcut, /delete |
|
/createmultiple | - | Flag used to transform a set of questions into a multiple question. The following parameters can be used : /questions, /inverted, /modalities, /questioncaption, /shortcut, /delete, /noyes |
|
/datafile | String | String used to specify the additional file or directory or DB connection.
/datafile:"C:\ThisFile.xml" |
|
/definitionfile | String |
String that indicates the path of the stacked export definition file (used by /runverification) |
|
/delete | - |
Flag used to indicate if interviews should be deleted after having been moved when using /mergeinterviews. |
|
/deleteduplicates | - |
Flag used to request a removal of duplicate interviews matched by seed, agentID and start interview |
|
/deleteinterviews | - |
Flag used to request a deletion of interviews QES. |
|
/detailed | - |
Flag used to indicate if the export indicates the modalities |
|
/directory | String |
A string to specify where the files will be generated. |
|
/entrycodeformultiple | - |
Flag used to create multiple shortcut with entry codes. /entrycodeformultiple:1 (used by /exportsav) |
|
/excludequestions | String |
A string that specifies which questions will be excluded from the export. [from v5.4.8.0] |
|
/executequery | - |
Flag used to run an export to SQL table. The following parameters can be used : /datafile, /query /completes, /incompletes, /additionalfilter, /datafile, /before, /after |
|
/excluderegex | String | A string to specify which questions will be excluded from the export based on a regular expression. [from v5.4.8.0] |
|
/exitonerror | - | Flag used to indicate that the run should be interrupted if an error is encountered (used by /runmacro) | |
/exportdat | - |
Flag used to export interview files (.dat files) to a directory. The following parameters can be used : |
|
/exportdatamap | - | Flag used to export the simplified datamap of a survey. The following parameters can be used : /datafile, /detailed |
|
/exportdelimited | - | Flag used to request an export in ASCII delimited. The following parameters can be used : /completes, /incompletes, /additionalfilter, /datafile, /sepquestion, /sepresponse, /closedtype, /questions, /unicode, /before, /after, /multipleasbinary, /semiopen, /repeatmultipleseparator |
|
/exportdimensions | - |
Flag used to request an SPSS Dimensions export. [from v5.6.0] |
|
/exportdkasnormal | - | Flag to prevent system closed DKs to be exported as 0 (used by /exportsav) | |
/exportfixedlength | - | Flag used to request an export in ASCII fixed length using the simplified data-map. The following parameters can be used : /completes, /incompletes, /additionalfilter, /datafile, /before, /after | |
/exportmultimedia | - | Flag used to export multi-media files (pictures, sounds, etc..) from open-ended questions into a directory using the /datafile naming pattern . The following parameters can be used : /additionalfilter, /completes, /incompletes, /before, /after |
|
/exportfield | Flag used to request an export to an Askia field survey (SQL format) through the CcaWebAPI (used by /targetUrl, /targetUserName, /targetPassword) [from v5.6.0] |
||
/exportinverted | Flag used to request an export to an inverted Askia survey (QEX file format) [from v5.6.0] |
||
/exportqes | - | Flag used to request an export to an Askia survey (QES file format) [from v5.6.0] |
|
/exportsav | - | Flag used to request an export in SAV format. The following parameters can be used : /completes, /incompletes, /additionalfilter, /datafile, /preventreindexing, /keepunderscores, /prefixloopitems, /exportdkasnormal, /before, /after |
|
/exporttiming | - | Flag used to request an export of the timing of the questions. The following parameters can be used : /completes, /incompletes, /additionalfilter, /datafile, /idquestion, /before, /after |
|
/exporttripleS | - | Flag used to request an export in tripleS (2.0) format. The following parameters can be used : /completes, /incompletes, /additionalfilter, /datafile, /before, /after |
|
/forceonerror | - | Flag used to indicate that the errors should be ignored. (used by /runmacro) |
|
/generate | - | Flag used to indicate if the datamap should be generated if not present (it's not saved) (used by /exportfixedlength and /exportdatamap) |
|
/groupdk | - | Flag to indicate that all modalities defined in systemdk should be coded as the system DK (code -1) (used by /importpkd, /importdimensions and /importtriples) |
|
/idquestion | String | String that indicates the shortcut for the question used as an ID. (used by /exporttiming, /overwrite, /importinnewlevel, /mergequestionnaireusingid) |
|
/importado | - | Flag used to request an ADO importation | |
/importdat | Flag used to request an import of askiaweb .dat interviews. The actual directory should be specified in the /datafile parameter |
||
/importdatadelimited | - | Flag used to request an import into an existing QES file. The following parameters can be used : /datafile, /sepquestion, /sepresponse, /closedtype, /alwayspoint |
|
/importdimensions | - | Flag used to request an import of any SPSS dimensions file into inverted QES file. The actual Dimensions connection string should be specified in the /datafile parameter |
|
/importfixedlength | - | Flag used to request an import in ASCII fixed length using the simplified data-map. The following parameters can be used : /datafile |
|
/importinnewlevel | - |
Flag used to request the import of a survey into a new level. The matching is done using a question whose shortcut is defined in the parameter /idquestion. The new loop's shortcut is defined by the parameter /shortcut . |
|
/importpkd | - | Flag used to request an import of a PKD file into inverted QES file. The actual PKD file should be specified in the /datafile parameter |
|
/importsav | - | Flag used to request an import of an SPSS sav file. The sav file should be specified in the /datafile parameter. The following parameters can be used : /datafile, /inverted, /noscaled |
|
/importtriples | - | Flag used to request an import of a XML Triple-S file. The TripleS file should be specified in the /datafile parameter |
|
/importxmlinterviews | - | Flag to import XML interviews done in Capi mode (AskiaFace). | |
/incompletes | - | Flag used to indicate if the selection should include the incompletes interviews | |
/inverted | - | Flag used to indicate if the data should be read or written from / into the inverted data format (used by /importtriples, /importsav, /createloop, /createmultiple, /createclosed, /importado ) |
|
/keepunderscores | - | Flag used to ensure the underscores are kept in the shortcuts (used by /exportsav) | |
/language | String |
Value that specifies the language abbreviation or code that will be used. /Language:”FRA” (used by /importtriples, /importsav, /importdimensions, /exporttriples, /exportsav, /exportdatamap, /exportdelimited, /exportdimensions) [from v5.5.3.0] |
|
/logfile: | String | String indicating the path of the file that should be used as a logfile for reporting errors (errors will be appended at the end). |
|
/markascomplete | - | Flag used to request a selection of interviews to be marked as complete. The following parameters can be used : /additionalfilter, /setquestion, /setvalue, /before, /after |
|
/markasincomplete | - | Flag used to request a selection of interviews to be marked as incomplete. The following parameters can be used : /additionalfilter, /setquestion, /setvalue, /before, /after |
|
/maxdiscrete | Integer | Indicates the maximum number of discrete values, above which the imported question will be considered a numerical question (default 10) (used by /importado) | |
/maxresponse | Integer | Indicates the maximum number of responses, above which the imported question will be considered as a closed question (default 20) (used by /importado) | |
/mergeinterviews | - | Flag used to request a merge of interviews QES. The following parameters can be used : /sourcepath, /sourcesurveyconnection, /sourcesurveyid, /mergetype, /delete, /preserveid, /completesonly, /additionalfilter |
|
/mergequestionnaire | - | Flag used to merge two surveys which have the same number of interviews . The following parameters can be used : /sourcepath, /sourcetype, /sourcesurveyconnection, /sourcesurveyid |
|
/mergequestionnaireusingid | - | Flag used to request the import of a survey and data with an ID into a new level. The matching is done using a question whose shortcut is defined in the parameter /idquestion. The following parameters can be used : /idquestion, /sourcepath, /sourcetype, /sourcesurveyconnection, /sourcesurveyid |
|
/mergetype | Integer | Value specifying the merge type to use. | 0 : assume questionnaires are superposable 1 : using shortcuts and entry codes 2 : using internal question and response ids |
/modalities | String | A string to specify the modalities (string separated by ;) or the loop items of the question created by /createmultiple or /createloop | |
/multipleasbinary | - |
Flag that indicates multiple questions are exported as separate questions for each responses (0/1) (used by /exportdelimited) |
|
/multipletype | Value |
Value indicating which format should be used to export multiple closed questions (used by /exportsav) |
0 : use question ranking flag (check if the question is ranked - default behaviour) 1 : always use dichotomy 2 : always use ranking (export with the full list of resonses as a ranking) |
/multipleseparator | String |
A string to specify the separator of multiple closed questions. /multipleseparator:”_” (used by /exportsav) |
|
/nohide | - | Flag used to indicate that the used questions are not hidden in analyse, if /delete is not used (used by /createclosed) |
|
/noscaled | - | Flag used to indicate that the imported single questions should not be marked as scaled (used by /importsav) |
|
/noyes | - | Flag used to specify if the multiple closed questions in /createmultiple are defined as No / Yes instead of Yes / No (default) | |
/numericDK | String | Stringto indicate if a numeric value should be interpreted as a system DK (used by /importpkd, /importdimensions and /exportsav from v5.6.0) | |
/opensize | Integer |
Value that specifies the size of open ended. The command line default is set to 1024. /opensize:2048 (used by /exportsav) From v5.6.0 /opensize:1 auto detects the open ended questions' size |
|
/overwrite | - | Flag used to request an overwrite using a question ID and an ASCII file. The following parameters can be used : /datafile, /idquestion, /sepquestion, /sepresponse, /closedtype |
|
/overwritewithsql | - | Flag used to request an overwrite of a question using a matching SQL table. The following parameters can be used : /datafile (the connection), /query, /sourcequestion, /targetquestion, and for the selection of interviews: /completes, /incompletes, /additionalfilter, /before, /after | |
/overwritewithtable | - | Flag used to request an overwrite of a question using a matching ASCII table. The following parameters can be used : /datafile, /sepquestion, /sourcequestion, /targetquestion, and for the selection of interviews: /completes, /incompletes, /additionalfilter, /datafile, /before, /after | |
/pid | String | Process ID : an identifier that will be used when reporting error in the logfile | |
/prefixloopitems | - | Flag used to prefix captions with loop items (used by /exportsav) | |
/prefixsubquestions | - | Flag to indicate that sub-question will be prefixed by their parent chapter or loop (used by /importpkd and /importdimensions) | |
/preservecase | - | Flag to indicate that the shortcuts case should be kept when exporting to SAV format./preservecase:1(used by /exportsav) [from v5.6.0] |
|
/preserveid | - | Flag used to indicate if the IDs of the interview should be kept and not the auto increment property. (used by /mergeinterviews) |
|
/preventreindexing | - | Flag used to prevent shortcuts being incorrectly reindexed. (used by /exportsav) |
|
/query | String |
String that indicates the SQL query used during the ADO importation (used by /importado and /overwritewithsql) |
|
/questioncaption | Integer | Value that indicates which question caption should be used on the first row. | 1 : sortcut 2 : short caption 3 : long caption |
/questioncaptionloop | Integer | Value that indicates which loop caption should be used on the first row. | 1 : entry code 2 : order 3 : caption |
/questioncaptionresponse | Integer | Value that indicates which loop caption should be used on the first row. | 1 : entry code 2 : order 3 : caption |
/questioncaptionseparator | String | A string to specify the delimiter used on the first row to separate loop caption and iterations or question caption and answers when multiple as binary. | |
/questions | String | String to specify which questions will be used: you can use a prefix and all questions whose shortcut start by this will be selected or you can separate shortcuts by `;` | |
/questionselection | String | A string that specifies which questions will be exported based on their properties. (Used by /exportdelimited, /exportsav, /exporttripleS, /exportqes, /exportinverted, /exportfield/exportdimensions) [from v5.6.0] |
|
/reducedsurvey | - |
Flag that indicates if you want to run the scripts on a sub-survey containing only the questions referred in the script (fast option) (used by /runverification /runedits) [from v5.4.9.0] |
|
/regex | String | A string to specify which questions will be selected in the export based on a regular expression. | |
/removehtml | - |
Flag that removes all HTML tags from the survey captions. (used by /exportdelimited, /exportsav, /exporttriples, /exportqes) |
|
/removeaskiascript | - |
Flag that replaces in-line Askia script used in the survey captions with "_". (used by /exportdelimited, /exportsav, /exporttriples, /exportqes) |
|
/repeatmultipleseparator | - | Flag that always exports the same number of separators for multiple question. | |
/respondentid | String |
String that specifies the Respondent ID. /respondentid:”Respondent.Serial” (used by /importdimensions) |
|
/runedits | - |
Flag used to request a run of the edits. You need to use both parameters /completes & /incompletes if you want to run edits on all interviews. (used by /completes /incompletes /additionalfilter and /reducedsurvey). |
|
/runmacro | - | Flag used to request the run of a macro to create mutliple question and loops. The following parameters can be used : /datafile, /isExitOnError, /isForceOnError |
|
/runverification | - | Flag used to run a verification script (used by /completes, /incompletes, /additionalfilter, /before, /after) [from v5.4.9.0] |
|
/samesizeloopentrycode | - |
Flag indicating that loop items entry codes should have the same size. /samesizeloopentrycode:1 (used by /exportsav) |
|
/semiopen | - | Flag specifying that semi-open data should be exported. (used by /exportdelimited) |
|
/sepquestion | String | String to specify the question separator in an ASCII file. (tab by default) |
|
/sepresponse | String | String to specify the response separator for a multiple question in an ASCII file. (comma by default) |
|
/setquestion | String | Sting indicating the shortcut of the question that will be updated when the interview is marked as complete / incomplete (used by /markascomplete, /markasincomplete, /setvalue ) |
|
/setvalue | String |
String that indicates the value taken by the question that will be updated when the interview is marked as complete / incomplete /setquestion:"Q1" /setvalue="1" (used by /markascomplete, /markasincomplete, /setquestion ) |
|
/shortcut | String | A string to specify the shortcut of the question created by /createloop, /createclosed, /createmultiple, /importinnewlevel | |
/shortcutpostfixtype | Value |
Value indicating how the shortcut of multiple closed questions should be postfix (used by /exportsav) |
0 : postfix with order 1 : postfix with entry codes 2 : postfix with same size entry codes |
/sourcepath | String | String used to specify the source QES file. (used by /mergeinterviews, /mergequestionnaire, /mergequestionnaireusingid) |
|
/sourcequestion | String | String that specifies a shortcut for the question used as source (used in /overwritewithtable and /overwritewithsql) |
|
/sourcesurveyconnection | String | String used to specify the source QES connection string if the data is in SQL server. (used by /mergeinterviews, /mergequestionnaire, /mergequestionnaireusingid) |
|
/sourcesurveyid | Integer | Value used to specify the id of the source survey if the data is in SQL server. (used by /mergeinterviews, /mergequestionnaire, /mergequestionnaireusingid) |
|
/sourcetype | Integer |
Value used to indicate the type of the source file. (used by /mergeinterviews, /mergequestionnaire, /mergequestionnaireusingid) |
0: QES 1: in SQL Server (Legacy format) 2: inverted data format 3: Data stored in SQL Server (new SQL format) 4 : Data stored in WebInterviews SQL database |
/sourcewebtable | String |
(used by /type:4, /sourcesurveyconnection, /ImportInNewLevel, /MergeQuestionnaire, /MergeQuestionnaireusingID) |
|
/stackedexport | String |
Flag used to request an export of stacked (level) data. Only works with predefined xml stacked export definition. The following parameters are required: /definitionfile, /datafile. |
|
/systemdk | String | A string to specify which responses (separated by ;) will be set with a Don't Know base type (used by /importpkd, /importdimensions and /importtriples) |
|
/targetquestion | String |
A string indicating the shortcut for the question used as targe. (used in /overwritewithtable and /overwritewithsql) |
|
/unicode | - | Flag used to make sure the data is exported in Unicode | |
/usefactors | - |
Flag use to indicate that values (factors) of scaled responses should be exported. /usefactors:1 [from v.5.6.0] |
|
/uselongcaption | - |
Flag use to make sure long captions will be used in the SAV export /uselongcaption:1 (used by /exportsav) |
|
/targetpassword | String |
Supervisor's user password used to connect the CcaWebAPI when exporting an Askia survey to field. /targetpassword:"password" (used by /exportfield) |
|
/targeturl | String |
CcaWebAPI URL to use when exporting an Askia survey to field. /targetUrl:"https://ServerName/CcaWebAPI" (used by /exportfield) |
|
/targetusername | String |
Supervisor's user name used to connect the CcaWebAPI when exporting an Askia survey to field. /targetUserName:"Supervisor" (used by /exportfield) |
Examples
1. Import askiaweb interview data
To import .dat files from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /importdat /datafile:"c:\The directory with the .dat"
2. Import PKD data
To import a .PKD files from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My New Qes File.qes" /importpkd /datafile:"c:\my directory\pkdfile.pkd"
3. Import Dimensions data (here triple-S)
To import a triple-S files from the command line into a QES file use the following syntax:
Tools.exe "d:\qes\res.qes" /importdimensions /datafile:"Provider=mrOleDB.Provider.2;Data Source=mrTripleSDsc;Location=d:\TripleS\P9.asc;Initial Catalog=d:\TripleS\P9.xml;Mode=ReadWrite;MR Init MDSC=mrTripleSDsc;" /pid:201 /"logfile:d:\qes\logfile.txt"
4. Import SAV data
To import a SAV files from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My New Qes File.qes" /importsav /datafile:"C:\my directory\savfile.sav"
To import a SAV files in inverted format from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My New Qes File.qes" /importsav /inverted /datafile:"C:\my directory\savfile.sav"
5. Import Triple S XML data
To import a triple-S XML files from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My New Qes File.qes" /importtriples /datafile:"c:\my directory\triplesfile.sss"
6. Merge interviews
To merge interviews from the command line from one QES file to another use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /mergeinterviews /"sourcepath:D:\Qes\ex2.qes" /mergetype:1 /delete /completesonly /preserveid /additionalfilter:"EndInterview < now - 14"
Or with SQL data:
Tools.exe "C:\test\qes1.qes" /mergeinterviews /sourcepath:"C:\test\qes2.qes" /sourcesurveyconnection:"Provider=sqloledb; Data Source=XXXXXXX; Initial Catalog=Surveys;Trusted_Connection=no;User Id=XXXXXX;Password=XXXXX" /sourcesurveyid:123 /sourcetype:3 /mergetype:0
Or with webinterviews data :
Tools.exe "C:\test\qes1.qes" /mergeinterviews /sourcepath:"C:\test\qes2.qes" /sourcesurveyconnection:"Provider=sqloledb; Data Source=XXXXXXX; Initial Catalog=WebInterviews;Trusted_Connection=no;User Id=XXXXXX;Password=XXXXX" /sourcewebtable:"MyWebTable" /sourcetype:4 /mergetype:0
7. Delete interviews
To delete all complete and incomplete interviews from the command line from one QES file to another use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /deleteinterviews /completes /incompletes /additionalfilter:"EndInterview < now - 14"
Or with SQL data
Tools.exe "D:\Qes\ex1.qes" /surveyconnection:"Provider=sqloledb; Data Source=XXXXXXX; Initial Catalog=Surveys;Trusted_Connection=no;User Id=XXXXXX;Password=XXXXX" /surveyid:123 /type:3 /deleteinterviews /completes /incompletes /additionalfilter:"EndInterview < now - 14"
8. Compact and Repair
To compact and repair your QES file from the command line use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /compact
9. Transform into loop
To transform a serie of questions into a loop from the command line use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /createloop /questions:"qa1_12;qa1_13;qa1_14"
or
Tools.exe "D:\Qes\ex1.qes" /createloop /questions:"qa1_"
10. Transform into multiple
To transform a serie of questions into a multiple closed question from the command line use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /createmultiple /questions:"qa1_12;qa1_13;qa1_14"
or
Tools.exe "D:\Qes\ex1.qes" /createmultiple /questions:"qa1_"
11. Export the datamap to a text file
To export the datamap from the command line use the following syntax:
Tools.exe "D:\Qes\ex1.qes" /exportdatamap /datafile:"D:\Qes\datamap.txt" /detailed
12. Import fixed length ascii data
To import .asc files from the command line into a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /importfixedlength /datafile:"c:\The directory with the .asc"
13. Export fixed length ascii data
To export .asc files from the command line from a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /Exportfixedlength /datafile:"c:\my directory\File.asc"
14. Export delimited ascii data
To export .asc files from the command line from a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /exportdelimited /completes /sepquestion:; /sepresponse:, /datafile:"c:\my directory\File.asc"
15. Export delimited ascii data stored in SQL
To export .asc files from the command line from a QES file with the data stored in SQL use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /exportdelimited /completes /sepquestion:; /sepresponse:, /type:1 /surveyconnection:"Provider=SQLOLEDB.1;Data Source=127.0.0.1;Initial Catalog=Surveys;Persist Security Info=False;UID=XXX;PWD=xxx" /surveyid:xxx /datafile:"c:\folder\data.txt" /logfile:"c:\folder\log.txt"
16. Export delimited ascii data stored in the inverted files
To export .asc files from the command line from a QES file where the data is stored in the inverted files use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /type:2 /exportdelimited /completes /sepquestion:; /sepresponse:, /datafile:"c:\my directory\File.asc"
17. Export SAV
To export .sav files from the command line from a QES file where the data is stored in the QES files use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /exportsav /completes /datafile:"c:\my directory\File.sav"
18. Export Triple S
To export .sss files from the command line from a QES file where the data is stored in the QES files use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /exporttriples /generate /completes /datafile:"c:\my directory\File.sss"
19. Export multimedia files
To export collected multimedia files from the survey, use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /exportmultimedia /completes /datafile:"??shortcut????id??" /directory:"c:\my directory" /questions:"q1;q2"
20. Merge files using an ID
To export collected multimedia files from the survey, use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /mergequestionnaireusingid /sourcepath:"C:\test\qes2.qes" /sourcetype:3 /sourcesurveyconnection:"Provider=sqloledb; Data Source=XXXXXXX; Initial Catalog=Surveys;Trusted_Connection=no;User Id=XXXXXX;Password=XXXXX" /sourcesurveyid:4 /idquestion:"myID"
21. Import from Excel / Access
To import Excel files into a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /importado /datafile:"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\my directory\myfile.xlsx;Extended Properties=\"Excel 12.0 Xml;HDR=YES\"" /query:"SELECT * FROM [Feuil1$]" /maxdiscrete:100 /maxresponse:100 /inverted
22. Import XML interviews (from version 5.4.2)
To import XML interview files (AskiaFace for iOS / Android) e into a QES file use the following syntax:
Tools.exe "C:\my directory\My Qes File.qes" /importxmlinterviews /datafile:"C:\Interviews\Here"
23. Stack Export
To export a .qes file of level data use :
Tools.exe "C:\my directory\My Qes File.qes" /stackedexport /datafile:"C:\my directory\My Stacked File.qes" /definitionfile:"C:\my directory\Stacked Export Definition.xml"
24. Export SAV excluding questions (from version 5.4.8)
To export all questions except Q1, Q2 and Q3 use the following syntax :
Tools.exe "C:\my directory\My Qes File.qes" /exportsav /datafile:"C:\my directory\Output.sav /excludequestions:"Q1;Q2;Q3"
25. Detect & create loops and multiples using regex (from version 5.4.8) - The order of the questions does not matter i.e. they do not need to be consecutive in the .qes file
Ex1.
To create multiples from questions where alphanumeric string before '_' underscore marker is the same and text after is a number to denote response order in the multiple:
Tools.exe "C:\my directory\QesImportedFromSAV" /createmultiple /noyes /regex:"(.+)_[0-9]+"
e.g. this will group
- Questions RB93_1 through to RB93_20 into a multicode 'QRB93' with 20 codes
- Questions SA1_1 through to SA1_100 into a multicode 'QSA1' with 100 codes
- ... and continue to create more multiple questions with any groups of questions that match the pattern specified.
Ex2.
To create loops from questions where variable names end with "SLICE". Immediately before this there is a number to denote iteration order in the loop. Immediately before this there is some alphanumeric string for the variable names.
Tools.exe "C:\my directory\QesImportedFromSAV" /createloop /regex:"(.+)[0-9]+SLICE"
e.g. this will group
- Questions D15B1SLICE through to D15B10SLICE into a 10 iteration loop, 'Loop_D15B1SLICE' with child question, 'QD15B'.
- Questions SA-1SLICE through to SA-50SLICE into a 50 iteration loop, 'Loop_SA-1SLICE' with child question, 'QSA-'.
- ... and continue to create more looped questions with any groups of questions that match the pattern specified.
26. Run a verification script (from version 5.4.9)
To run a verification script use the following syntax :
Tools.exe "C:\my directory\EX.qes" /runverification /completes /definitionfile:"C:\my directory\MyScript.txt" /logfile:"C:\my directory\Output.txt /reducedsurvey
The ouput file looks like this
Asserts run: 400 Asserts failed: 201 Interviews run: 200 Interviews failed: 151 *** Line 1: 100 failed Interview 2 Interview 3 ... *** Line 2: 101 failed Interview 2 Interview 3 ... The process returns a value that can be read in powershell - it can be one of these
#define TER_NO_DATA_SELECTED -5 #define TER_FILE_EXCEPTION -9 (cannot read source file) #define TER_CANNOT_CREATE_TARGET_FILE -7 #define TER_INVALID_DEFINITION -6 (compilation error in script file) #define TER_CANNOT_OPEN_SOURCE_SURVEY_DB -1 #define TER_CANNOT_READ_SOURCE_INTERVIEW -2
Any positive or zero value: the number of interviews which failed the verification process
27. Opening a live survey (from version 5.4.9)
To export to ASCII delimited a live survey (you no longer need to use the SQL connection strings to access the live data), use the following command line:
Tools.exe /url:"http://ServerName/CcaWebApi" /username:"Supervisor" /password:"pwd" /surveyId:11 /exportdelimited /datafile:"c:\Qes\IhisOut.txt" /completes
28. Create new data column on-the-fly in delimited ascii export (from 5.4.9.4)
Create new data column on-the-fly in delimited ascii export which can access data from questions or individual responses conditionally by script.
You can add as many columns as you wish using the following syntax.
Tools.exe "C:\MyDirectory\EX.qes" /exportdelimited /completes /sepquestion:; /sepresponse:, /datafile:"C:\MyDirectory\MyExport.txt" questions:^i2_Age^ /addcolumn:"Male:^i1_Gender^ has {1}" /addcolumn:"Female:^i1_Gender^ has {2}"
29. Select questions to export based on their properties using `/questionselection` (from v 5.6.0)
Use the following command line to select open ended and date/time questions to ASCII delimited format
Tools.exe "C:\Qes\EX.qes" /type:0 /exportdelimited /completes /closedtype:2 /questionselection:"(CurrentQuestion.Type has {\"open\";\"datetime\"} )" /datafile:"C:\Qes\Myexport.txt"
The syntax below selects questions with tags "Demog" + "LifeStyle" and opend ended with anonymised question to Askia survey QES file format
Tools.exe "C:\Qes\Me\ExportData\ex.qes" /exportqes /completes /datafile:"C:\Qes\Me\ExportData\ExportDataRes.qes" /questionselection:"(CurrentQuestion.Tags Has {\"Demog\";\"LifeStyle\"} or CurrentQuestion.Type = \"open\") And (CurrentQuestion.IsAnonymised = False)" /additionalfilter:"i1_Gender = 1"
The same selection can be exported to Askia survey inverted format
Tools.exe "C:\Qes\Me\ExportData\ex.qes" /exportinverted /completes /datafile:"C:\Qes\Me\ExportData\ExportDataInv.qex" /questionselection:"(CurrentQuestion.Tags Has {\"Demog\";\"LifeStyle\"} or CurrentQuestion.Type = \"open\") And (CurrentQuestion.IsAnonymised = False)" /additionalfilter:"i1_Gender = 1"
And to Askia survey inverted field (SQL) format
Tools.exe "C:\Qes\Me\ExportData\ex.qes" /exportfield /targetUrl:"http://127.0.0.1/ccawebapi" /targetUserName:"Administrator" /targetPassword:”pwd" /completes /datafile:"NewExport" /questionselection:"(CurrentQuestion.Tags Has {\"Demog\";\"LifeStyle\"} or CurrentQuestion.Type = \"open\") And (CurrentQuestion.IsAnonymised = False)" /additionalfilter:"i1_Gender = 1"
30. Filter your data exports on string values using the "/additionalfilter:" command
In order to filter on strings using the "/additionalfilter:" command, you need to separate the string's double-quotes with a forward-slash: \
Like this:
/additionalfilter:"DUMCity.Value = \"Los Angeles\""
Tools.exe "D:\Exports\ExportFiles\EXAMPLE\EXAMPLE.qes" /exportdelimited /incompletes /completes /type:3 /closedtype:2 /additionalfilter:"DUMCity.Value = \"Los Angeles\"" /surveyconnection:"Provider=sqloledb;Data Source=127.0.0.1;Initial Catalog=Surveys;Trusted_Connection=no;User Id=XXXXX;Password=XXXXXX" /surveyid:XXX /datafile:"D:\Exports\ExportFiles\EXAMPLE\EXAMPLE.txt" /logfile:"D:\Exports\ExportFiles\EXAMPLE\log.txt"
Applying Commands to Multiple Files Quickly
To apply the same command to multiple files, one option is to use FORFILES from the command line. For example, to delete all interviews from all .qes files in the current directory and sub-directories, use the following:
FORFILES /S /M *.qes /C "cmd /S /C ^0x22C:\Program^ Files^ ^0x28x86^0x29\Askia\Tools.exe^0x22 @PATH /deleteinterviews /completes /incompletes"
Note the use of the ASCII code 0x22 to indicate quotes in the command line path. Similarly, 0x28 and 0x29 are used for opening and closing parentheses. These are necessary because the location of the AskiaTools executable is not added to the PATH variable of the server. The typical location (on an x64 version of Windows) is "C:\Program Files (x86)\Askia".
Multiple commands can be included by using an ampersand - & - separator. For example:
FORFILES /S /M *.qes /C "cmd /S /C ECHO @PATH & ^0x22C:\Program^ Files^ ^0x28x86^0x29\Askia\Tools.exe^0x22 @PATH /deleteinterviews /completes /incompletes"
Use of batch files (with one command split across multiple lines)
If you wish to keep a record of the command you use or wish to re-run it we suggest you create a batch (.BAT) file that contains the command(s). You may find the .BAT file easier to read and maintain if you split long command lines across several lines within the file. The general idea is that the ^ character indicates the next line will be a continuation.
So, for example, this command...
Tools.exe "D:\Qes\ex1.qes" /compact
..could appear in a .BAT file across 3 lines like this...
Tools.exe ^ "D:\Qes\ex1.qes" ^ /compact
However, if you need to split anything that appears within speech-marks across several lines it is a little more complicated. In that instance you will need a command in your .BAT file to indicate this is the case AND include some additional characters.
So, for example, this command...
Tools.exe "xtest.qes" /createmultiple /questions:"ANSWER_1;ANSWER_2;ANSWER_3;ANSWER_4;ANSWER_5"
...would require a .BAT file that looked like this...
setlocal EnableDelayedExpansion Tools.exe "xtest.qes" ^ /createmultiple ^ /questions:"ANSWER_1;!"=!^ ANSWER_2;^ ANSWER_3;^ ANSWER_4;^ ANSWER_5"
For more information, you may find this article useful.
Return error codes
Add this on a new line after your command has run to capture the error code in the command window:
cmd /k echo Exit Code is %errorlevel%
The process can return the values below. For more information, you may find this article useful.
#define TER_CANNOT_OPEN_SOURCE_SURVEY_DB -1 #define TER_CANNOT_READ_SOURCE_INTERVIEW -2 #define TER_CANNOT_WRITE_INTERVIEW -3 #define TER_UNKOWN_EXCEPTION -4 #define TER_NO_DATA_SELECTED -5 #define TER_INVALID_DEFINITION -6 #define TER_CANNOT_CREATE_TARGET_FILE -7 #define TER_CANNOT_LIST_SOURCE_INTERVIEWS -8 #define TER_FILE_EXCEPTION -9 #define TER_EXECUTION_ERROR -10 #define TER_LOGIN_REFUSED -11 #define TER_SURVEY_NOT_FOUND -12 #define TER_INVALID_SURVEY_FILE -13 #define TER_UNKNOWN_QUESTION -101 #define TER_INCOMPATIBLE_QUESTION -102 #define TER_CANNOT_READ_SOURCE_FILE -103
This is really helpful. Do we have command line for Design and Analyze?