Editing your interview
Edit your completed draft interview in the Docassemble playground
While the Weaver is a menu-driven, step-by-step process, you'll make further edits in the Playground. In the playground, you can directly edit the YAML text to:
- Change the wording of questions
- Change the datatype of questions and add show/hide logic
- Edit the order screens appear in
- Add conditional and branching logic
- Add new variables, such as variables calculated by code
Save your work frequently, and don't be intimidated. For the most part, many changes can be understood by reading the text and then experimenting.
This pages offers information about making some common, simple edits. You may also want to take this time to read through the materials in Introduction to Docassemble about the underlying Docassemble platform and how it works.
Double-check that you got things right in the Weaver stage
Some common mistakes, like typos in the labels, can lead to a lot of extra work. If you see "extra" questions appear, it's possible that you didn't get the names quite right, perhaps something as simple as a typo.
Work towards a readable, usable interview
You should also take this chance to review our guidance about writing good questions. While you edit your interview, work steadily to make it better.
Getting the draft into your playground
When you have finished using the Weaver, download your package. This will put a .zip file in the Downloads folder on your computer.
Safari, by default, will turn your downloaded package into a folder on your PC.
Before downloading the package, turn off that behavior:
- open Safari
- click Preferences
- under the General tab, uncheck the option Open 'safe' files after downloading
First, create a new "Project" in your playground. Using projects will help you keep your Docassemble code organized.

Next, upload this file to the Docassemble playground's Packages folder.

How to edit your interview
Navigate back to the main Playground window. You should see the YAML file with your interview's draft code.
Scroll through and take a look at the code. You will see:
- code blocks setting defaults for your interview
- a
main orderandinterview orderblock which list some of the variables that your interview uses, in order. question:blocks that contain the text of questions and the list of fields that are asked on each screen
You do not need to understand all of the code. Absorb what you can, and feel free to experiment. Save your code often, preferably to a GitHub repository.
You will likely start by clicking the "Save and Run" button to try running your interview through to the end. Note any awkward wording or changes you want to make.
Use the id that is on the top of each screen to find the screen that you want to change.
Then, change the text that you want to change, or change the order of fields.

Below we describe some of the most common starting customizations you will make, especially changes that interact with an Assembly Line convention. You can use any Docassemble feature in your interview.
Marking a field as optional (not required)
Add the required: False modifier to mark a field as optional.
For usability purposes, you might want to also add the phrase (optional)
to the label.
---
id: Tell me more about Respondent
question: |
Tell me more about the ${ other_parties[0] }.
fields:
- Name: user_name
- Attorney bar number (optional): bar_number
required: False
Controlling the order of questions
Locate the interview_order block in your YAML file.
Move the variable name that you want to ask earlier in your interview to
the place you want it to be asked.
It usually looks something like this:
---
#################### Interview order #####################
comment: |
Controls order and branching logic of questions in the interview
id: interview_order_Guardianship_Assistant
code: |
other_parties[0].name.first
if not last_option:
all_done
users[0].name.first
other_parties[0].birthdate
In the example above: if you wanted the other party's birthdate to be asked before you get the name of the user, you would simply switch the order of those 2 lines.
This section mentions a bit about interview order, but if you want to learn more, you can read it on the Legal Tech Class site.
Order is usually determined by the first variable on the screen
When the Weaver creates the interview order block, it adds the first (and only the first) variable on each screen to the interview order block. This lets you change the order quickly.
For example, if we wanted to add this question to the interview order block below,
you would add the variable temporary_needed to the interview order block because
temporary_needed is the first variable on this screen. When Docassemble tries to
define temporary_needed, it will show this screen and ask all of the questions
mentioned on it.
---
id: Temporary Guardianship
question: |
Do you need to the court to decide on this case in the next 90 days?
subquestion: |
${ collapse_template(when_temporary_guardianship_possible_template) }
fields:
- I need a temporary guardianship: temporary_needed
datatype: yesnoradio
- Do you need it right now?: need_now
datatype: yesnoradio
show if: temporary_needed
Adding conditional logic to the screen order
If a screen is conditional, you can add an if statement so that it only
appears when the condition is satisfied.
Example:
id: interview_order_Guardianship_Assistant
code: |
users[0].name.first
users.gather()
if has_co_petitioner:
users[1].address.address
else:
users[0].address.city
The syntax inside your interview order block is written in Python. You
can write more complex logic, including elif (for else if), use and, or
and comparisons with ==, in etc.
if statements can also be nested, using additional levels of indentation.
id: interview_order_Guardianship_Assistant
code: |
users[0].name.first
users.gather()
if has_co_petitioner:
users[1].address.address
if users[1].has_separate_mailing_address:
users[1].mailing_address.address
else:
users[0].address.city
Showing and hiding fields on an individual screen
To make a single field show or disappear on a screen that asks for some optional
information, use the show if modifier.
Example:
---
id: Tell me more about Respondent
question: |
Tell me more about the ${ other_parties[0] }.
fields:
- Date of Birth: other_parties[0].birthdate
datatype: date
- Primary Language: primary_language
choices:
- English
- Spanish
- Other
# You can check if the option is equal to an exact value
- Other language: primary_language_other
show if:
variable: primary_language
is: Other
- Is ${ other_parties[0] } a veteran?: op_is_veteran
datatype: yesno
# Or use the shorter syntax to check only if it is True
- What branch of the military?: armed_forces_branch
show if: op_is_veteran
# Or use the `code` option to check for a value defined on another screen
- Where does ${ other_parties[0] } work?: op_employer
show if:
code: |
op_is_employed
show if only allows with one variable at a time. If you need to check the value of
multiple variables in one if statement, you need to use the more complex
js show if.
When you use js show if, you need to use a JavaScript expression that uses the
function val() at least once. val() is a JavaScript function that returns
the value of a variable name that is visible on screen. It takes the name of the
Docassemble variable in quotes as its only parameter.
Here is a small example of a js show if expression:
---
id: Tell me more about Respondent
question: |
Tell me more about the ${ other_parties[0] }.
fields:
- Is ${ other_parties[0] } employed?: other_parties[0].is_employed
datatype: yesnoradio
- Is ${ other_parties[0] } a parent of your child?: other_parties[0].joint_parent
datatype: yesnoradio
- ${ other_parties[0] }'s monthly income: other_parties[0].income
datatype: currency
js show if: |
val("other_parties[0].is_employed") && val("other_parties[0].joint_parent")
Check the js show if
documentation to learn
how to use different combinations of values in a js show if expression. The
key is that you'll use ordinary JavaScript keywords to do any comparisons.
JavaScript is its own language, and keywords such as "or", "and" and even "=="
work slightly differently, as explained in the Docassemble documentation. You
can also use a general resource that documents JavaScript to learn more.
Adding conditional logic inside an attachment block
If you would like to make the display of a variable in the attachment conditional, you can use a multi-line Mako statement right inside the attachment block:
attachment:
variable name: my_document[i]
pdf template file: my_document.pdf
fields:
- "signature": |
% if i == "final":
${ users.signature }
% endif
It is a good habit to use these multi-line blocks so that the logic is easy to read and understand later.
You can use exactly the same Mako
syntax in the attachment block
that you would use inside a question or subquestion modifier.
Adding new screens
Adding questions to the interview
When you add a new question, it should go in at least 2, and possibly 3 places:
- The new screen that asks the question
- The interview order block
- The review screen block, so it can be edited later
The simplest option is probably to find a question that is a good model for your
new question, copy and paste it, and change the text, id, and variable names.
For example:
---
id: any unique id to help you find this question later
question: |
Your question
subquestion: |
The subquestion
fields:
- Prompt 1: variable_1
Then you would need to make sure the interview order block mentioned variable_1:
---
id: interview_order_Guardianship_Assistant
code: |
other_parties[0].name.first
if not last_option:
all_done
variable_1
users[0].name.first
other_parties[0].birthdate
You should also find the review: block in your
interview, and add a way for your user to change
their answer.
- Edit: variable_1
button: |
**Variable 1**:
${ variable_1 }
Learn more about review screens.