Pular para o conteúdo principal

FV Decipher Support

Todos os tópicos, recursos necessários para FV Decipher.

Base de Conhecimento da FocusVision

Generating Data from the Command Line

  Requires Decipher Cloud

Overview

The generate script is used to generate data files from the command line.

For example:

generate . all tab > all_data.txt

The command above generates all of the respondent data available in the tab-delimited format and outputs it to a file named "all_data.txt". A snippet of this file is shown below:

record  uuid              date              markers     status  Q1  ...
1       qb9nuj5u6utptzap  05/13/2014 16:01  qualified   3       3   ...
5       zu520guzq6ugbv3y  05/13/2014 16:31  qualified   3       2   ...
3       sve0pnufdzewfwtn  05/13/2014 17:04  qualified   3       4   ...
2       uvkr5yus8e7bm67w  05/13/2014 17:21  qualified   3       3   ...
4       a037mefyqp8d0n0z  05/13/2014 17:32  qualified   3       4   ...
6       4k0a11cyh2sw08mq  05/13/2014 17:51  qualified   3       2   ...

1:  Generate Syntax & Options

The syntax for the generate command is shown below:

Syntax

generate [-avp] [--layout=layout] [--force-oe] [--encoding=charset] <survey> <config> <datatype> [fields]

Option Descriptions

Option Description
-a Output all fields, including hidden ones. By default, generate will output the same information as you would find in the data downloads area. Specify -a to output all information, including hidden questions like ones with where="none" set.
-p Execute Python code. You can specify custom Python logic to generate data only where a Python expression evaluates to True.
e.g. generate -p . "Q1.r1 and qualified" tab > Q1_r1_data.txt
-v Verbose mode.
--layout Allows you to specify a layout # for generating the data file rather than the standard layout or variables.xls.
--force-oe Force OE data to be generated.
--encoding The default output of the generate command will be the same character set as the survey. You can override and force this to be any character set.
e.g. generate --encoding=utf8
--textual Responses will be generated as answer text instead of numbers.
e.g. generate --textual . all xlsx out.xlsx
--stack

Use to retrieve stacked data file. Can be set to:

  • top: outputs all looped variables
  • label:  outputs looped data for the specified loop
<survey> The path to the survey to generate data from. e.g. selfserve/9d3/proj1234
<config> The type of respondent data to generate. Choose any of the following or use the -p modifier to specify custom Python logic:
  • all : terminated, overquota and qualified
  • qualified : qualified only
  • config : configuration of a saved report (appears after config= in report URL)
  • partials : partials only
  • everything : "all" + partials
  • 'Python Expression' : Python expression if -p option is set
<datatype> The type of data to generate. Can be set to:
  • fw
  • pipe
  • flat
  • flat_all
  • cb
  • cbtext
  • tab
  • sav
  • tab-text
  • csv
  • excel
  • wincross
  • datamap [fw html oe]
  • xlsx (use the --textual option to get answer values)
  • json
You may also generate files into a ZIP bundle.
e.g. generate . all zip:spss.fw,data.fw myFile.zip
[fields] The variables you want to generate if you don't want all variables.use --
e.g. generate . all tab uuid status Q1 > data.txt

Notes:

  • Running generate to create an SPSS *.sav file will create an SPSS 16+ unicode-enabled file by default.
  • Be sure to only use the supported Excel format (.xlsx) when generating a excel dataset via the command line as shown in the example below.

2:  Examples

The following generate commands are all valid:

# Tab Delimited Output of "all" data
generate . all tab > tab_delimited.txt

# Generate Using Python Expressions
generate -p . 'Q1.r1 and terminated' tab > Q1_terms.txt
generate -p . 'Q2.r1.val < 40 and qualified' tab > Q2_quals.txt
generate -p . 'hasMarker("/Concept/C1") and overquota' tab > C1_OQs.txt
generate -p . 'date_range("01-jan-2014", "31-jan-2014")' tab

# Generate ALL Variables
generate -a . everything tab > all_data.txt

# Bundle in SPSS Download
generate . all zip:spss.fw,data.fw myFile.zip

# Generate Partial Data
generate . partials tab > partial_data.txt

# Generate Based on Report Configuration
generate . '$FS1oQ' tab > report_config_data.txt

# Generate Only Certain Fields
generate . all tab uuid date status Q1 Q2r1 Q2r2 Q2r3 > my_data.txt

# Generate Certain Fields Sorted By Record
generate . all tab record uuid data markers | sort > sorted_data.txt

# Generate Completes Between Midnight 14 Days Ago to End of Day Today
generate -p . 'date_days(14, 0)' tab uuid date

# Generate an XLSX Excel 2007 File
generate . all xlsx out.xlsx

# Generate an XLSX Excel 2007 File with Text Answers Instead of Numbers
generate --textual . all xlsx out.xlsx

# Generate an SPSS File
generate . all sav out.sav