Business logic: Difference between revisions

Jump to navigation Jump to search
Line 20: Line 20:
== Rules ==
== Rules ==


Rules are scripts that run directly in the mobile application. They offer a way for setting up business logic using [[Woodford]]. Rules can be placed on multiple [[user interface components]]:
* [[Form]]
* [[View]]
* [[Route plan]]
* [[Calendar]]
* [[Map]]


== Scripting language ==
[[File:Sample rule.png|thumb|right|300px|Sample rule]]
Rules are formed in a simple scripting language. Essentially, you combine '''conditions''' and '''steps'''.
{| class="wikitable"  style="display: inline-table; vertical-align:top;"
! Conditions
|-
|
* If...
* Then...
* Else...
|}
{| class="wikitable"  style="display: inline-table; vertical-align:top;"
! Steps
|-
|
* Hide fields
* Set read-only
* Assignment
* Set GPS position
* Say text
* Set a variable
* Load a fetch
|}
You don't write scripts, you build them and using buttons and selecting values from a drop-down menu.
== Objects in rules ==
Rules allow you to evaluate and modify parameters of various objects:
* Entity - edit/create/delete records
* Form - modify what's displayed on a form
* Tabs - modify all the tabs of a form
* Variables / shared variables - Save a value as a variable to use later in a rule, display, or use in a different rule
* Configuration - currently logged-in user, URL, online/offline status, etc.
* Relationship - determine whether a form is opened via associated view
* Specialties
== Form rules ==
Form rules describe sequences of steps that are executed on form-related events. They allow you to for example to customize edit form user interface (hide or disable fields, assign values, etc.).
; On Load: These rules are checked when you open a form. You can use these rules for example to apply custom format to certain records.
; On Change: These rules are checked when you open a form or modify any field. Example: simple form validation.
; On Save: These rules are checked when you save a record. For example, saving a record can automatically also update a field in a parent record.
Rules also control the behavior of commands: when should a command be displayed and what should it do.
* '''On Can Execute''' rule defines when the command will be available for the user.
* '''On Execute''' rule defines the actions that the command performs.


[[Category:Core concepts]]
[[Category:Core concepts]]

Navigation menu