Normally, the label on a GROUP statement is in quotes and cannot be changed. With the LABEL method type, a GROUP can be labeled dynamically.
Take this snippet of DecoderScript:
FIELD myField (Fixed 1 Byte) (Decimal) “My Field”
GROUP “My Group”
{
}
The content of the group is unimportant. The interesting thing here is “My Group”. Normally that would be static text but if we use a LABEL method as below:
FIELD myField (Fixed 1 Byte) (Decimal) “My Field”
GROUP LABEL (FromField myField Decimal)
{
}
If myfield has a value of 0x01, the label on myGroup will be ‘1’. This method works just like a FORMAT method except its output is a label.
This format works even with TABLEs. See this example:
TABLE myTable
{ 0 “zero” }
{ 1 “one” }
ENDTABLE
FIELD myField (fixed 1 byte) (decimal) “My Field”
GROUP LABEL (Table myTable myfield decimal)
{
}
Again, we have a method that works just like the FORMAT table method except it outputs to the LABEL.
LABEL methods only work for GROUPs, not FIELDs or GROUPFIELDs.
Another creative method is LabelCount.
FIELD init_cntr (Fixed 0) RETRIEVE (StoreInteger 1) (hex) SUPPRESS_DETAIL STORE cntr GROUP information REPEAT SIZE (ToEndOfLayer) "Attribute Handles"
{
GROUP handle_uuid_pairs LABEL(LabelCount "Attribute Handle-Type(UUID) pair" cntr)
{
FIELD handle (Fixed 2) (Decimal) "Attribute Handle"
FIELD uuid_2 (Fixed 2) IF(FieldIs EqualTo 1 format) (Hex) "Attribute Type"
FIELD uuid_16 (Fixed 16) IF(FieldIs EqualTo 2 format) (Hex) "Attribute Type"
}
FIELD increment_count (Fixed 0) RETRIEVE (StoreField cntr) ALSO (AddInteger 1) (Decimal) SUPPRESS_DETAIL STORE cntr