This article will cover the syntax of the ‘Tag’ regular script statement

This statement is used to add tags to fields and tables. Tags are a way for a developer to give additional information about specific fields/ tables.

Statement syntax

Tag [field | fields | table] [fieldlist | tablelist] [with | using] [tagname | mapname];

Field | Fields | TableKeyword to specify what is to be tagged.
Fieldlist | TablelistA comma separated list of fields or tables to be tagged.
With | UsingA keyword for specifying the tag. If one tag is being applied, use ‘with’, If you are adding tags using a map, use ‘using’.
Tagname | MapnameIf the same tag is to be given to all fields/ tables specified, give the tag name here. If you are using a map to tag fields/ tables with different tags, give the map name here.

Example

Fields in a table get tagged using a tag map.

ITEM_DETAILS:
LOAD 
	*
FROM [lib://Public:DataFiles/ITEM_DETAILS.qvd] (qvd);
TAG_MAP:
MAPPING LOAD * INLINE [
  a,b
  id, identify
  cost, monetary
  type, string
  flavour, string
];
Tag fields using TAG_MAP;

Result

The specified fields are tagged as per the map. The tags can be viewed in the data model viewer.