SchoolForms

Template Scripting

A Basic script language can be used when processing a template to build a form.

Each command is on a separate line in the template scripting advanced option of a form entry.

  • repeat the start of a repeatable section

  • until {expression} - return to the form item with 'repeat' if the test is not true

  • add({variable},2) - add 2 to a variable

  • adddate({variable},7) - add 7 days to a date variable

  • adddate({variable},1,week|month|year) - add a timespan to a date variable

  • let {variable}={value} set a variable to a value - special variable values are:

  • let ColumnName={value} set the current item columnname

  • let DefaultValue={value} set the current item default value

  • let Subscript={value} set the current item subscript value

  • let Text={value} set the current item text value

  • if {expression} evaluate an expression true or false

  • then {} if the previous if was true then execute the {} statement

  • else {} if the previous if was false then execute the {} statement

{value} use [[variable]] for replacing values

{expression} is {value}>|<|>=|<=|={value}

Template scripting Example1

Template control - weeks dropdown number of weeks 1-5

Template control - startdate input type Date

Form control - Section [[startdate]]

let week=1

repeat

Form control - Monday

let ColumnName=Mon[[week]]

Form control - last item in the section

adddate(startdate,7)

add(week,1)

until [[week]]>[[weeks]]