Macros in Link 3
Macros in Link can be used to generate context that can be used for Filenaming keys (for File naming types), transport fields, tracking fields or custom purpurses.
The format of the macro is like this:
[[:identifier$arg$fallback:]]
Where the arg and fallback is optional based on identifier. When several args they are seperated by ;
Identifier can be:
CustomDateTime e.g. [[:CustomDateTime$ddMMyyyyhhmmssffff:]]
Valid mask for formating datetime is .Net DateTime ToString formats
UniqueId e.g. [[:UniqueId:]]
Will output a value like 785419c9-98e5-4eb5-831d-46741a54ce96
ExtensionOut e.g. [[:ExtensionOut:]]
Will output the format type default extention from the outgoing document config
FileNameIn e.g. [[:FileNameIn:]]
Takes the original filename the document arrived in. Be aware it might not be unique.
FileNameInNoExt e.g. [[:FileNameInNoExt:]]
Takes the original filename the document arrived in but without extension. Be aware it might not be unique.
CustomXPath e.g. [[:CustomXPath$/*[local-name()='Cdm_SalesInvoice']/*[local-name()='Header']/*[local-name()='InvoiceDate']:]]
Will get the string value of the node-set returned from the xpath (which is the text value from the first node in the node-set)
Context e.g. [[:Context$DocumentNumber;http://link.bizbrains.com/properties/document:]]
Will get a value from a context property.
Sequence e.g. [[:Sequence$MySeqNumber;0000000000:]]
Take a new sequence number. First parameter is the name of the sequence. Second parameter is optional and contains a mask for the sequence. Pad with 0 (zero) to ensure a number or # for optional number. E.g. 0000 will always output a 4 digit number event if the sequence is 5 digit. #0000 will always have at least 4 digits but will if the number is 5 digit it will contain 5.
LinkSetting e.g. [[:LinkSetting$MySettingKey:]]
Lookup the given key in LinkSettings and replace the macro with the value of the setting. If no value is found or the value is empty - an expection (with error code SWWYG) is thrown.
Notice! The fallback value is not available for this macro and will be ignored.
Â
Macroes can be combined like e.g.:
[[:CustomDateTime$yyyyMMddhhmmssffff:]]_[[:UniqueId:]].[[:ExtensionOut:]]
will result in e.g.:
202301100408458094_785419c9-98e5-4eb5-831d-46741a54ce96.xml
Â
Â
Usages
Macros can currently be used the following places:
Itinearary step parameters (textbox fields)
Transport configuration fields (textbox fields)
Filenaming types (Key)
Batching config (Batching key)
Â
Â
Â
Â
Â
Â
The information on this page is based on Link 3.00