How can I use conditional fields ?

 FAQ

Conditional fields are a convenient way to handle empty values. It is often desireable to drop leading or trailing texts in signatures if a field is not defined or empty in Active Directory. Adolsign supports five directives in field definitions:



--prefix text Adds text in front of the field if it is not empty
--postfix text Adds text at the end of the field if it is not empty
--ignoreline Drops the whole line if the field is empty. NB! option ignoreline has limited support for html signatures (removes br / tag only) and rtf signatures (remove \par tag only).
--default text Use text as default if the field is empty
--case directive[,...] ... Use directive for case manipulation. Allowed directives are lowercase, uppercase, lowerfirst, upperfirst. Multiple directives are allowed and they will be processed in the specified order.
--anchor type Generate HTML code for dynamic links. As an example --anchor http creates an http link.
--format format Formats the value according to the format. As an example, --format "%s%s *** %s%s" produces 12 *** 34 for the value 1234.


Conditional directives can be defined by using the following syntax:

scancode( one or more conditional directives )scancode 

Examples:

field_telephone( --prefix "Tel: " )field_telephone

Produces Tel: +11111111 if the telephone number is +11111111. Produces nothing if it is empty.

field_department( --prefix "Department: " --ignoreline )field_department

Produces Department: Sales if the department is Sales. Produces nothing and removes the whole line if it is empty.

field_homepage( --default "www.default.com" --case lowercase )field_homepage

Converts the homepage to lowercase. Produces www.default.com if the homepage is not defined.