Examples: Writing formulas that evaluate to a result

  1. This example is the default value formula for the From field in a standard discussion database. It consists of a single @function that returns the user's name.
    @UserName
  2. This example is an adaptation of the input validation formula for the Subject field in a standard discussion database. It consists of an @If function that returns failure if the Subject field is blank (the user did not enter a value) and success if the Subject field contains something. The failure condition has the side-effect of printing a message.
    @If(Subject = ""; @Failure("You must enter a subject for your document."); @Success)
  3. This example is an adaptation of the window title formula for the Memo form in a standard discussion database. It is a single statement, but it contains embedded @If commands. If the current document is new, the window title becomes "New Memo." If the current document already existed and the Subject field exists and is not blank, the window title becomes the value of the Subject field, prepended by ">> " if it has attachments. If the Subject field does not exist or is blank, the window title becomes the creation date.
    @If(@IsNewDoc; "New Memo"; @If(@IsAvailable(Subject) & Subject != ""; @If(@Attachments; "» "; "") + Subject; @Text(@Created)))