Free-Conversant Support / Message Conditional Macro: msg.label.id
 Home   About Conversant   Free Sites   Hosting   Support   XML-RPC 

Search



Documentation >> Conditionals >> Messages >> msg.label >> msg.label.id

Message Conditional Macro: msg.label.id

Operators:

  • == (equal to)
  • != (not equal to)
  • greaterThan
  • greaterThanOrEqualTo
  • lessThan
  • lessThanOrEqualTo

Usage Notes

  • Tests the id of the label assigned to the current message, comparing it with the |conditional value| on the right side of the |conditional operator|.

  • The id of a label is a code that Conversant uses to 'identify' labels, and is normally hidden from view, but you can display the ID in the interface where labels are defined. A label id looks like "0000014".

  • The ID is essentially a number, and the operators that test for differences between two label id's (including "greatherThan", "greaterThanOrEqualTo", "lessThan", and "lessThanOrEqualTo") will first convert the ID to a number in order to make the comparison. That means that when you write your conditional, you aren't required to include the preceding zeros in the ID: "0000127" is the same as "127".

  • Using label ID's in a conditional macro will be probably be a rarity. However, there are two facts about label ID's that may make it an attractive option for the advanced user: the ID never changes, and the ID is guaranteed to be unique (no other label in that conversation will ever have the same ID).

    If you want to build a conditional based on a specific label, and there is any chance that the name of that label will ever change, you're better off using the msg.label.id conditional instead of the msg.label.name conditional. Names can change, ID's can not. If you used msg.label.name, and then later changed the name of the label, you'd have to find every place that you used the conditional and edit it to match the new name.

  • Unlabelled messages are given the ID of 0000000 (zero), so you can test for unlabelled messages by providing a |conditional value| as '0000000' or just '0'.

Examples

In this example, the first line will be shown if the message has not been given a label, the second if the message has been labelled with the support site's "Documentation" label (which has label ID 8), and the third if neither of the previous tests are true.

<!--#if condition="msg.label.id == '0000000'"-->

1. This message has not been given a label.

<!--#elseif condition="msg.label.id == '0000008'"-->

2. This message's label id is 8, which corresponds to our documentation label.

<!--#else-->

3. This message has a label, but it's not label ID 8.

<!--#endIf-->

See the above code in action, here:

2. This message's label id is 8, which corresponds to our documentation label.
View in DG