Show a module or form only when it applies
Set a condition that keeps a module or a form out of the way until it is relevant.
Most apps have a module or a form that only some people need, or that only makes sense for some cases. A display condition keeps that item out of the way until it applies, so the person using the app sees a short, relevant list instead of everything the app can do.
Every module and every form can carry one. A menu that shows its forms in the menu above has no entry to hide, so its condition shows or hides its forms there. A submenu's forms also follow the parent menu's condition.
Keep an item off the menu
Some items should never be listed at all: a form reached only from another form's after-submit link, or only from a deep link. Turn off Show on the menu in the item's settings. The switch is on by default.
An item that is off the menu is not listed anywhere. A module that is off the menu takes every form in it off the menu too, and its submenus with it, since no menu reaches them. What still opens a form that is off the menu depends on the platform:
- On Android, it opens from an after-submit link or from a deep link.
- In Web Apps, it opens only from a deep link that ignores display conditions.
A module that is off the menu can't be an after-submit link's destination and takes no deep link of its own. See After submit and Deep links for each.
A display condition you keep stays with the item and applies again once you turn Show on the menu back on. A condition that starts with "never" is refused, because the switch is how you say an item is never listed.
Add a condition
Open the item's settings and find When shown on the menu:
- For a module, open it and choose the settings gear. A bare case list keeps its settings on the Search / Results / Details strip.
- For a form, open the form and choose the settings gear.
Choose Add condition. Nova commits a starting condition and opens the full editor in the middle of the screen, where you build the rule out of plain clauses, a value, a comparison, and what to compare it with. Group clauses together with All conditions must match or Any condition can match, and nest as deeply as the rule needs.
The settings panel then shows a one-line summary of the rule, with Edit condition to reopen the editor and Always show to remove it.
Every condition has its own address, so you can link a teammate straight to it.
Read “Where this is checked” first
The editor opens with a short explanation of where the condition takes effect, because that decides what the condition can use. It is not the same for every item.
A module's condition is checked on the app's home screen, before anyone opens a module or picks a case. It can use the worker's sign-in information, the worker's saved record, data tables, and counts of cases available on that device. For example, you can show Household visits when at least one household is available.
A form's condition is checked wherever people choose that form, and that depends on the module it sits in:
- If every form in the module opens an existing case, people pick the case first. Nova checks the condition straight afterwards, for the case they picked, so the condition can read that case and follow its connections. The module then lists its forms, even when it holds only one, and a form whose condition the case does not match is left off that list.
- If any form in the module starts a new case (or collects a plain survey), or the module chooses some case apart from the rest (a case list in the menu of a module CommCare HQ receives as an advanced one, see Case changes), people choose the form before they pick a case. Nova checks the condition on that form list, where there is no case yet, so it can use fixed values and information about the person signed in.
Worker record reads information saved on the person's own record. Sign-in information reads the values the device received for this session. Choose the source that holds the value your rule uses. A worker's team may be supplied at sign-in, while the date they finished training may be saved on their record.
A date can be compared with before or after. A time of day can't: CommCare
compares these as numbers and a time is not one, so the condition would never
be true. The editor offers before, after and between for a number or a date,
and not for a time of day. Two dates and times compare by the moment each
names, on every device as in Preview. A case's opened date and last-changed
date hold only the day on a device, so a condition can't compare either with
a moment such as now(). You can wrap both sides in date() to compare days
instead.
Watch it work
Turn on Preview from any condition screen and Nova runs the surface the condition governs, against your real case data:
- a module's condition runs the app's home screen, where the module either appears or does not;
- a form's condition runs that form, so you can work through it and step back to the list the condition gates.
Navigate the running app as a worker would; the condition decides what appears. Leaving Preview returns you to the condition you were editing.
Preview never simply hides things without saying so. A screen whose list is being narrowed shows Hidden items with a count; opening it lists the items that are hidden, each with the condition it is waiting on.
The authoring canvases are the opposite: they never hide a conditioned item, so your app's structure always stays visible and editable.
A condition is not a permission
A display condition decides what a screen offers, not who may see the data behind it. The app still carries the hidden item and everything it reads. Use conditions to keep the app focused on what someone needs right now, not to keep data away from people.
Removing a condition
Always show removes the condition and confirms what that changes before it does, from the settings row or from the condition screen. The item then appears every time. Like every other edit in the builder, you can undo it.
Add a badge beside an item
Open the module or form settings and find Menu badge. Enter a short label, such as “New”, or choose Use a calculation to show a value such as the number of outstanding visits. A text badge has a translation for each app language. Remove badge clears it from the menu.
In Preview, choose the platform your workers use. Web Apps shows the full badge. Android leaves a zero or empty value off the menu. A longer integer such as 1234 shows as “999+”, and longer words are shortened.
Badges are a feature of CommCare HQ's Advanced and Enterprise plans. When you publish an app that has one, Nova asks you to confirm that the project space's plan includes them. Without them, people editing the app in CommCare HQ can't change its badges.