Variables can be used throughout the DocMgt system. You can use them during entry and searching and when designing Work Triggers


There are two types of variables - Data Value variables and Function variables.



Data Value Variables

When working in the context of a Record, you can use the data values from that record by wrapping the field name in brackets. This can be useful for concatenating values. For example, if you have a Record with a field named Status and another named StatusDate you could use "[Status] on [StatusDate]" to set a value like "Complete on 11/15/2015". For Work Triggers it is common to set the trigger due date using a field value - i.e. [DUEDATE].



Function Variables

Function variables allow you to use system values, perform calculations and do look ups from other sources. They are very powerful and can be nested together to make long and complex calculations. The inner most variables are replaced first then the outer ones are replaced in order until all variables are replaced, producing the final output.


For example, if we have a record with a field named DueDate that has the value '3/7/2018' and today is that date then the following variables will all compute the same:


[DAY] = 7

[DAY(3/7/2018)] = 7

[DAY([DueDate])] = 7


Likewise, if we have another Record with fields Received=3/7/2018 and DaysDue=60 we can use those to compute a due date:


[DATEADD([Received]|0|0|[DaysDue])]  = 5/6/2018


Breaking it down into steps:


[DATEADD([Received]|0|0|[DaysDue])]  = Original formula


[DATEADD(3/7/2018|0|0|[DaysDue])]  = Replaced [Received] with 3/7/2018


[DATEADD(3/7/2018|0|0|60)]  = Replaced [DaysDue] with 60


So, we are basically saying add 0 years, 0 months and 60 days to the date of 3/7/2017 which returns 5/6/2018.




Naming Conflicts

It is usually best to name your data fields different from the function variables. For instance, the variable [DATE] is used by the system to read the current date. If you have a data field named DATE then which will the system return? The default action is for the system to return the function values first which would be today's date. However, if you have no way of changing your Date field's name then you can still get the value with one slight change. Instead of using [DATE] to get your value use [FIELD(DATE)] or the shorthand version which is [(DATE)]. This will tell the system to use your field instead of the function variable.



Ignoring Strings

There are cases where you need to ignore sections of the input strings. If your input string is bracketed (i.e. [TEST], you will need to surround that string with special characters to keep it from being evaluated. You can use [~ and ~] to have the system ignore the internal string. For instance, "This is a [TEST] of the system" will normally return "This is a  of the system" (unless there is a variable named TEST in the Record). However, "This is a [~[TEST]~] of the system" will return "This is a [TEST] of the system". This is very useful when using REGEX patterns because they almost always use bracketed values which you do not want to replace.