Functions
Index
Base.append!Base.insert!Base.prepend!Base.writeCitrusBuilder.array_five_point_choice_questionCitrusBuilder.array_increase_decrease_questionCitrusBuilder.array_questionCitrusBuilder.array_ten_point_choice_questionCitrusBuilder.array_yes_no_questionCitrusBuilder.attributesCitrusBuilder.date_selectCitrusBuilder.defaultCitrusBuilder.default_languageCitrusBuilder.descriptionCitrusBuilder.dropdown_list_questionCitrusBuilder.equationCitrusBuilder.file_uploadCitrusBuilder.five_point_choice_questionCitrusBuilder.gender_selectCitrusBuilder.has_attributesCitrusBuilder.has_defaultCitrusBuilder.has_descriptionCitrusBuilder.has_helpCitrusBuilder.has_otherCitrusBuilder.has_response_optionsCitrusBuilder.has_subquestionsCitrusBuilder.helpCitrusBuilder.huge_text_questionCitrusBuilder.idCitrusBuilder.is_mandatoryCitrusBuilder.language_settingCitrusBuilder.language_settingsCitrusBuilder.language_switchCitrusBuilder.languagesCitrusBuilder.long_text_questionCitrusBuilder.multiple_choice_questionCitrusBuilder.multiple_numerical_inputCitrusBuilder.multiple_short_text_questionCitrusBuilder.numerical_inputCitrusBuilder.question_groupCitrusBuilder.radio_list_questionCitrusBuilder.rankingCitrusBuilder.same_defaultCitrusBuilder.set_default_language!CitrusBuilder.short_text_questionCitrusBuilder.subquestionCitrusBuilder.surveyCitrusBuilder.text_displayCitrusBuilder.titleCitrusBuilder.xmlCitrusBuilder.yes_no_question
Constructors
Base.append! — Functionappend!(component::AbstractSurveyComponent, item)Insert one or multiple items to the end of component's children. Returns the appended item.
Examples
julia> s = survey(100000, "my survey")
julia> append!(s, question_group(1, "a question group"))julia> s = survey(100000, "my survey")
julia> append!(s, [
question_group(1, "first question group"),
question_group(2, "second question group")
])Base.insert! — Functioninsert!(component::AbstractSurveyComponent, index::Integer, item)Insert one or multiple items into component's children at the given index. Returns the appended item.
Examples
julia> s = survey(100000, "my survey") do
question_group(1, "first question group"),
question_group(2, "second question group")
end
julia> insert!(s, 2, question_group(3, "between first and second question group"))
julia> s
Survey with 3 groups and 0 questions.
my survey (id: 100000)
├── first question group (id: 1)
├── between first and second question group (id: 3)
└── second question group (id: 2)Base.prepend! — Functionprepend!(component::AbstractSurveyComponent, item)Insert one or multiple items to the beginning of component's children. Returns the prepended item.
Examples
julia> s = survey(100000, "my survey")
julia> prepend!(s, question_group(1, "first question group"))julia> g = question_group(1, "a question group")
julia> qs = [
gender_select("q1", "A gender select"),
short_text_question("q2", "Please state your full name.")
]
julia> prepend!(g, qs)Survey
CitrusBuilder.survey — Functionsurvey(id, title::String; children, settings)Construct a single-language Survey. children is an optional keyword argument and can be omitted.
Examples
Survey without children
julia> s = survey(100000, "my survey")
Survey with 0 groups and 0 questions.
my survey (id: 100000)
survey with children
julia> s = survey(100000, "my survey", children = [
question_group(1, "first question group"),
question_group(2, "second question group")
])
Survey with 2 groups and 0 questions.
my survey (id: 100000)
├── first question group (id: 1)
└── second question group (id: 2)survey(children::Function, id, title::String; settings)Construct a single-language Survey using do ... end syntax.
Examples
julia> s = survey(100000, "my survey") do
question_group(1, "first question group"),
question_group(2, "second question group")
end
Survey with 2 groups and 0 questions.
my survey (id: 100000)
├── first question group (id: 1)
└── second question group (id: 2)
survey(id, language_settings::LanguageSettings; children, settings)Construct a multi-language Survey. children is an optional keyword argument and can be omitted.
Examples
Survey without children
julia> s = survey(100000, language_settings([
language_setting("en", "A multi-language survey"),
language_setting("de", "Eine mehrsprachige Umfrage")
]))
Survey with 0 groups and 0 questions.
A multi-language survey (id: 100000)Survey with children
julia> s = survey(100000, language_settings([
language_setting("en", "A multi-language survey"),
language_setting("de", "Eine mehrsprachige Umfrage")
]), children = [question_group(1, language_settings([
language_setting("en", "first question group"),
language_setting("de", "Erste Fragengruppe")
]))])
Survey with 1 group and 0 questions.
A multi-language survey (id: 100000)
└── first question group (id: 1)survey(children::Function, id, language_settings::LanguageSettings; settings)Construct a multi-language Survey using do ... end syntax.
Examples
julia> s = survey(100000, language_settings([
language_setting("en", "A multi-language survey"),
language_setting("de", "Eine mehrsprachige Umfrage")
])) do
question_group(1, language_settings([
language_setting("en", "first question group"),
language_setting("de", "Erste Fragengruppe")
]))
end
Survey with 1 group and 0 questions.
A multi-language survey (id: 100000)
└── first question group (id: 1)
QuestionGroup
CitrusBuilder.question_group — Functionquestion_group(id, title::String; description, children)Construct a single-language question group. Both description and children are optional keyword arguments that can be omitted.
Examples
julia> g = question_group(1, "a question group")julia> g = question_group(1, "a question group"; description="A simple description")julia> questions = [short_text_question("q$i", "question $i") for i in 1:3]
julia> g = question_group(1, "a question group"; children=questions)question_group(children::Function, id, title::String; description)Construct a single-language question group using do...end syntax. description is an optional keyword argument that can be omitted.
Examples
julia> g = question_group(1, "a question group") do
short_text_question("q1", "first question")
endquestion_group(id, language_settings::LanguageSettings; children)Construct a multi-language question group. children is an optional keywird argument that can be omitted.
Examples
julia> g = question_group(1, language_settings([
language_setting("de", "Eine Fragengruppe"),
language_setting("en", "A question group")
]))question_group(children::Function, id, language_settings::LanguageSettings)Construct a multi-language question group using do...end syntax.
Examples
julia> g = question_group(1, language_settings([
language_setting("de", "Eine Fragengruppe"),
language_setting("en", "A question group")
])) do
short_text_question("q1", language_settings([
language_setting("de", "Eine Frage")
language_setting("en", "A question")
]))
endQuestion
CitrusBuilder.jl provides convencience constructors for all question types described in the LimeSurvey Manual.
Text Questions
CitrusBuilder.short_text_question — Functionshort_text_question(id, language_settings::LanguageSettings; kwargs...)
short_text_question(id, title::String; help=nothing, default=nothing, kwargs...)Construct a short text question. If the question is constructed using a title, the global default language is used by default.
For a list of available keyword arguments see Question.
Examples
Simple short text questions using a single language can be constructed using a title string.
julia> q = short_text_question("q1", "my question")To construct a multi-language short text question, use language_settings.
julia> q = short_text_question("q2", language_settings([
language_setting("en", "question title"),
language_setting("de", "Fragetitel")
]))CitrusBuilder.long_text_question — Functionlong_text_question(id, language_settings::LanguageSettings; kwargs...)Construct a multi-language long text question.
For a list of available keyword arguments see Question.
long_text_question(id, title::String; help, default, kwargs...)Construct a single-language long text question.
For a list of available keyword arguments see Question.
CitrusBuilder.huge_text_question — Functionhuge_text_question(id, language_settings::LanguageSettings; kwargs...)Construct a multi-language long text question.
For a list of available keyword arguments see Question.
huge_text_question(id, title::String; help, default, kwargs...)Construct a single-language long text question.
For a list of available keyword arguments see Question.
CitrusBuilder.multiple_short_text_question — Functionmultiple_short_text_question(id, language_settings::LanguageSettings; subquestions, kwargs...)Construct a multi-language multiple short text question.
For a list of available keyword arguments see Question.
multiple_short_text_question(id, title::String; subquestions, help, kwargs...)Construct a single-language multiple short text question.
For a list of available keyword arguments see Question.
multiple_short_text_question(children::Function, id, language_settings::LanguageSettings; kwargs...)Construct a multi-language multiple short text question using do...end syntax.
For a list of available keyword arguments see Question.
multiple_short_text_question(children::Function, id, title::String; help, kwargs...)Construct a single-language multiple short text question using do...end syntax.
For a list of available keyword arguments see Question.
Single Choice Questions
CitrusBuilder.five_point_choice_question — Functionfive_point_choice_question(id, language_settings::LanguageSettings; kwargs...)Construct a multi-language five point choice question.
For a list of available keyword arguments see Question.
five_point_choice_question(id, title::String; help=nothing, kwargs...)Construct a single-language five point choice question.
For a list of available keyword arguments see Question.
CitrusBuilder.dropdown_list_question — Functiondropdown_list_question(id, language_settings::LanguageSettings, options::ResponseScale; kwargs...)Construct a multi-language dropdown list question.
For a list of available keyword arguments see Question.
dropdown_list_question(id, title::String, optins::ResponseScale; help=nothing, kwargs...)Construct a single-language dropdown list question.
For a list of available keyword arguments see Question.
CitrusBuilder.radio_list_question — Functionradio_list_question(id, language_settings::LanguageSettings, options::ResponseScale; comment=false, kwargs...)Construct a multi-language radio list question.
For a list of additional keyword arguments see Question.
radio_list_question(id, title::String, options::ResponseScale; help=nothing, kwargs...)Construct a single-language radio list question.
For a list of additional keyword arguments see Question.
Multiple Choice Questions
CitrusBuilder.multiple_choice_question — Functionmultiple_choice_question(id, language_settings::LanguageSettings; subquestions, comments=false, kwargs...)Construct a multi-language multiple choice question.
For a list of additional keyword arguments see Question.
multiple_choice_question(id, title::String; subquestions, help=nothing, kwargs...)Construct a single-language multiple choice question.
For a list of additional keyword arguments see Question.
multiple_choice_question(children::Function, id, language_settings::LanguageSettings; kwargs...)Construct a multi-language multiple choice question using do...end syntax.
For a list of additional keyword arguments see Question.
multiple_choice_question(children::Function, id, title::String; kwargs...)Construct a single-language multiple choice question using do...end syntax.
For a list of additional keyword arguments see Question.
Array Questions
CitrusBuilder.array_five_point_choice_question — Functionarray_five_point_choice_question(id, language_settings::LanguageSettings; subquestions, kwargs...)
array_five_point_choice_question(id, title::String; subquestions, help=nothing, kwargs...)
array_five_point_choice_question(children::Function, id, language_settings::LanguageSettings; kwargs...)
array_five_point_choice_question(children::Function, id, title::String; kwargs...)Construct an array five point choice question.
For a list of additional keyword arguments see Question.
CitrusBuilder.array_ten_point_choice_question — Functionarray_ten_point_choice_question(id, language_settings::LanguageSettings; subquestions, kwargs...)
array_ten_point_choice_question(id, title::String; subquestions, help=nothing, kwargs...)
array_ten_point_choice_question(children::Function, id, language_settings::LanguageSettings; kwargs...)
array_ten_point_choice_question(children::Function, id, title::String; kwargs...)Construct an array ten point choice question.
For a list of additional keyword arguments see Question.
CitrusBuilder.array_yes_no_question — Functionarray_yes_no_question(id, language_settings::LanguageSettings; subquestions, kwargs...)
array_yes_no_question(id, title::String; subquestions, help=nothing, kwargs...)
array_yes_no_question(children::Function, id, language_settings::LanguageSettings; kwargs...)
array_yes_no_question(children::Function, id, title::String; kwargs...)Construct an array yes/no question.
For a list of additional keyword arguments see Question.
CitrusBuilder.array_increase_decrease_question — Functionarray_increase_decrease_question(id, language_settings::LanguageSettings; subquestions, kwargs...)
array_increase_decrease_question(id, title::String; subquestions, help=nothing, kwargs...)
array_increase_decrease_question(children::Function, id, language_settings::LanguageSettings; kwargs...)
array_increase_decrease_question(children::Function, id, title::String; kwargs...)Construct an array increase/decrease question.
For a list of additional keyword arguments see Question.
CitrusBuilder.array_question — Functionarray_question(id, language_settings::LanguageSettings, options::VectorOrElemenet{ResponseScale}; subquestions, type="default", kwargs...)
array_question(id, title::String, options::VectorOrElement{ResponseScale}; help=nothing, kwargs...)
array_question(children::Function, id, language_settings::LanguageSettings, options; kwargs...)
array_question(children::Function, id, title::String, options; kwargs...)Construct an array question.
Specify the question type to determine which kind of array question is to be constructed. If type="dual" then an array of 2 ResponseScale must be provided. Otherwise a single ResponseScale is required.
Available types
"default": Array"text": Array (Texts)"dropdown": Array (Numbers)"dual": Array dual scale"bycolumn": Array by column
Mask Questions
CitrusBuilder.date_select — Functiondate_select(id, language_settings::LanguageSettings; minimum=nothing, maximum=nothing, kwargs...)
date_select(id, title::String; help=nothing, kwargs...)Construct a date select question.
Keyword arguments
minimum: The minimum allowed datemaximum: The maximum allowed date
For a list of additional keyword arguments see Question.
CitrusBuilder.file_upload — Functionfile_upload(id, language_settings::LanguageSettings; kwargs...)
file_upload(id, title::String; help=nothing, kwargs...)Construct a file upload question.
CitrusBuilder.gender_select — Functiongender_select(id, language_settings::LanguageSettings; kwargs...)Construct a multi-language gender select.
gender_select(id, title::String; help=nothing, kwargs...)Construct a single-language gender select.
CitrusBuilder.language_switch — Functionlanguage_switch(id, language_settings::LanguageSettings; kwargs...)Construct a multi-language language switch.
language_switch(id, title::String; help=nothing, kwargs...)Construct a single-language language switch.
CitrusBuilder.numerical_input — Functionnumerical_input(id, language_settings::LanguageSettings; minimum=nothing, maximum=nothing, integer_only=false, kwargs...)
numerical_input(id, title::String; help=nothing, kwargs...)Construct a multi-language numerical input.
Keyword arguments
minimum: The minimum valuemaximum: The maximum valueinteger_only: Permit only integer values
CitrusBuilder.multiple_numerical_input — Functionmultiple_numerical_input(id, language_settings::LanguageSettings; subquestions, kwargs...)
multiple_numerical_input(id, title::String; subquestions, help=nothing, kwargs...)
multiple_numerical_input(children::Function, id, language_settings::LanguageSettings; kwargs...)
multiple_numerical_input(children::Function, id, title::String; kwargs...)Construct a multiple numerical input question.
CitrusBuilder.ranking — Functionranking(id, language_settings::LanguageSettings, options::ResponseScale; kwargs...)
ranking(id, title::String, options::ResponseScale; help=nothing, kwargs...)Construct a ranking question.
CitrusBuilder.text_display — Functiontext_display(id, language_settings::LanguageSettings; kwargs...)
text_display(id, title::String; help=nothing, kwargs...)Construct a text display question.
CitrusBuilder.yes_no_question — Functionyes_no_question(id, language_settings::LanguageSettings; kwargs...)
yes_no_question(id, title::String; help=nothing, kwargs...)Construct a yes/no question.
CitrusBuilder.equation — Functionequation(id, language_settings::LanguageSettings; kwargs...)
equation(id, title::String; help=nothing, kwargs...)Construct an equation question.
SubQuestion
CitrusBuilder.subquestion — Functionsubquestion(; id, language_settings, relevance = "1")Construct a multi-language subquestion.
subquestion(; id, title, relevance = "1")Construct a subquestion using the default survey language.
LanguageSettings
CitrusBuilder.language_settings — Functionlanguage_settings(settings; same_default=false)
language_settings(language, title; same_default=false, kwargs...)Construct LanguageSettings for a survey component. Settings for single can either be provided as settings::Vector{LanguageSetting} (see also language_setting) or a combination of language and title.
If multiple languages are provided and same_default=true then the default value of the default language is inherited by all other languages.
Examples
Simple construction of language settings for a single language:
language_settings("de", "Ein Titel")If multiple languages are needed, construct settings using a vector of language_setting
language_settings([
language_setting("en", "A title"),
language_setting("de", "Ein Titel")
])To inherit the default value of the default language, same_default can be used
language_settings([
language_setting("en", "title", default="placeholder value"),
language_setting("de", "Titel")
], same_default=true)CitrusBuilder.language_setting — Functionlanguage_setting(language, title; kwargs...)Construct a LanguageSetting for a survey component.
Arguments
language: A language code. For a list of all available languages see https://translate.limesurvey.org/languages/title: The title of the survey component
Keyword arguments
description: A description of the survey componenthelp: A help text that is displayed for the survey component (questions only)default: The default value of the survey component (questions only)
Examples
language_setting("en", "title")
language_setting("en", "question title", help="some help for survey participants")Accessors
CitrusBuilder.id — Functionid(component::AbstractSurveyComponent)Return the id of a survey component.
Examples
julia> q = short_text_question("q1", "title")
julia> id(q)
"q1"CitrusBuilder.title — Functiontitle(component::AbstractSurveyComponent, language::String)Return the title of the a survey component for a given language. If language is not provided the title for the default language of the component is returned.
Examples
julia> g = question_group(1, "my title")
julia> title(g)
"my title"julia> g = question_group(1, language_settings([
language_setting("en", "my title"),
language_setting("de", "Mein Titel")
]))
julia> title(g, "en")
"my title"
julia> title(g, "de")
"Mein Titel"CitrusBuilder.help — Functionhelp(component::AbstractSurveyComponent, language::String)Return the help string of a survey component for a given language. If language is not provided the help for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", "my question", help="some help")
julia> help(q)
"some help"CitrusBuilder.has_description — Functionhas_description(component::AbstractSurveyComponent, language::String)Returns whether or not the survey component has a description for a given language. If language is not provided the value for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", "title")
julia> has_description(q)
false
julia> q = short_text_question("q2", "title", description="some description")
julia> has_description(q)
trueCitrusBuilder.description — Functiondescription(component::AbstractSurveyComponent, language::String)Returns the description of a survey component for a given language. If language is not provided the description for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", "title", description="answer this question")
julia> description(q)
"answer this question"
julia> q = short_text_question("q2", language_settings([
language_setting("en", "some description"),
language_setting("de", "Eine Beschreibung")
]))
julia> description(q)
"some description"
julia> description(q, "de")
"Eine Beschreibung"CitrusBuilder.languages — Functionlanguages(component::AbstractSurveyComponent)Return a vector of languages of a survey component.
Examples
For components with a single language
julia> s = survey(100000, "survey title")
julia> languages(s)
["en"]For multi-language components
julia> q = short_text_question("q1", language_settings([
language_setting("en", "title"),
language_setting("de", "Titel")
]))
julia> languages(q)
["en", "de"]CitrusBuilder.same_default — Functionsame_default(component::AbstractSurveyComponent)Return if the survey component uses the same default value for all languages.
Examples
julia> q = short_text_question("q1", "title", default="some default value")
julia> same_default(q)
falsejulia> q = short_text_question("q1", language_settings([
language_setting("en", "title", default="some default value"),
language_setting("de", "Titel")
], same_default=true))
julia> same_default(q)
trueCitrusBuilder.has_help — Functionhas_help(component::AbstractSurveyComponent, language::String)Return whether or not the survey component has a help string for a given language. If language is not provided the value for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", "title")
julia> has_help(q)
false
julia> q = short_text_question("q2", "title", help="some help")
julia> has_help(q)
trueCitrusBuilder.default_language — Functiondefault_language(component::AbstractSurveyComponent)Return the default language of a survey component. The default language is defined as the first language of the component.
Examples
julia> g = question_group(1, "group title")
julia> default_language(g)
"en"The default language of a survey component is not necessarily equal to the global default language set by set_default_language!.
julia> default_language()
"en"
julia> g = question_group(1, language_settings([
language_setting("de", "Gruppentitel"),
language_settings("en", "group title")
]))
julia> default_language(g)
"de"default_language()Get the currently set default language (default: "en"). If no explicit language is provided when constructing Survey, QuestionGroup or Question the survey components will inherit the default language.
See also
To set the default language use set_default_language!
CitrusBuilder.default — Functiondefault(component::AbstractSurveyComponent, language::String)Return the default value of a survey component. If language is provided the default value for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", language_settings([
language_setting("en", "title", default="placeholder"),
language_setting("de", "Titel", default="Platzhalter")
]))
julia> default(q)
"placeholder"
julia> default(q, "en")
"placeholder"
julia> default(q, "de")
"Platzhalter"CitrusBuilder.has_default — Functionhas_default(component::AbstractSurveyComponent, language::String)Return whether or not a survey component has a default value for a given language. If language is not provided the default value for the default language of the component is returned.
Examples
julia> q = short_text_question("q1", "title")
julia> has_default(q)
falsejulia> q = short_text_question("q2", "title", default="placeholder")
julia> has_default(q)
trueCitrusBuilder.is_mandatory — Functionis_mandatory(question::Question)Check if a Question is mandatory.
Examples
julia> q = short_text_question("q1", "A question")
julia> is_mandatory(q)
falsejulia> q = short_text_question("q1", "A mandatory question", mandatory=true)
julia> is_mandatory(q)
trueCitrusBuilder.has_other — Functionhas_other(question::Question)Check if a Question has response option 'other'.
CitrusBuilder.has_subquestions — Functionhas_subquestions(question::Question)Check if a Question has any subquestions.
Examples
julia> q = short_text_question("q1", "A question")
julia> has_subquestions(q)
falsejulia> q = multiple_short_text_question("q1", "Multiple questions") do
subquestion("sq1", "subquestion 1"),
subquestion("sq2", "subquestion 2")
end
julia> has_subquestions(q)
trueCitrusBuilder.has_response_options — Functionhas_response_options(questions::Question)Check if a Question has any response options.
Examples
julia> q = five_point_choice_question("q1", "A question")
julia> has_response_options(q)
falsejulia> options = response_scale([response_option("o1", "option 1")])
julia> q = dropdown_list_question("q1", "A dropdown question", options)
julia> has_response_options(q)
trueCitrusBuilder.has_attributes — Functionhas_attributes(question::Question)Check if a Question has any attributes.
Examples
julia> q = numerical_input("q1", "An input")
julia> has_attributes(q)
falsejulia> q = numerical_input("q1", "An input with attributes", minimum=0, maximum=10)
julia> has_attributes(q)
trueCitrusBuilder.attributes — Functionattributes(question::Question)Get the attributes of a Question.
Examples
julia> q = numerical_input("q1", "A numerical input", minimum=0, maximum=10)
julia> attributes(q)
Dict{String, Any} with 2 entries:
"min_num_value_n" => 0
"max_num_value_n" => 10Setters
CitrusBuilder.set_default_language! — Functionset_default_language!(lang::String)Set DEFAULT_LANGUAGE of CitrusBuilder.
Examples
set_default_language!("de")
[ Info: Default language set to 'de'.See also
To get the current value of DEFAULT_LANGUAGE see default_language.
IO
Base.write — Functionwrite(filename::AbstractString, survey::Survey)Write the XML structure of survey to a file. Make sure that the filename extension is .lss for the import in LimeSurvey.
Examples
julia> s = survey(100000, "my survey")
julia> write("mysurvey.lss", s)XML
CitrusBuilder.xml — Functionxml(survey::Survey)Construct an XML document from a Survey object.
Examples
julia> s = survey(100000, "my survey")
julia> xml(s)