Skip to main content

Formatting Standards

Consistent formatting of Duplex Sync rule definitions enhances readability and reduces ambiguity. This section provides detailed formatting guidelines to ensure your rule definitions are presented in a standardized way.

Rule Definition Structureโ€‹

Standard Formatโ€‹

Every rule definition should follow this structured format:

[Condition Clause (optional)] [Requirement Clause]

Where:

  • Condition Clause: Defines when the rule applies (starts with "If", "When", etc.)
  • Requirement Clause: Defines what must be true for the rule to pass

Examplesโ€‹

Simple Mandatory Rule:

โœ… 'isDangerousSubstance' (483) SHALL be indicated on the base unit level.

Conditional Rule:

โœ… If 'areBatteriesRequired' (211) is equal to 'TRUE', then 'areBatteriesIncluded' (210) SHALL be indicated.

Attribute Presence Terminologyโ€‹

Standard Formatโ€‹

Attributes should be referenced in this format:

'attributeName' (attributeID)

Where:

  • attributeName: The exact name of the attribute as defined in the GDSN standard.
  • attributeID: The numeric identifier of the attribute in parentheses.

Examplesโ€‹

Single Attribute Reference:

โœ… 'isPackagingMarkedReturnable' (1833)

Path-Based Attribute Reference: Instead of using full paths, refer to attributes by their name and ID. If context is needed, describe it in the rule.

โŒ 'tradeItemInformation/extension/dairyFishMeatPoultryItemModule/dairyFishMeatPoultryInformation/cheeseInformation/fatPercentageInDryMatter' (441)

โœ… 'fatPercentageInDryMatter' (441)

Standard Termsโ€‹

According to GS1 specification R16, use specific terminology for attribute presence:

ConditionCorrect TermAvoid
Attribute is present"used""populated", "filled", "provided"
Attribute is absent"not used""empty", "missing", "blank"

Examples:

โœ… IF 'preparationStateCode' (1225) is used, THEN...

โœ… IF 'countryOfOrigin' (3068) is not used, THEN...

Value Referencesโ€‹

Standard Formatโ€‹

Values should be referenced in this format:

'value'

Where the value is enclosed in single quotes.

Examplesโ€‹

Boolean Value:

โœ… If 'isTradeItemAConsumerUnit' (3066) is equal to 'true'...

Code Value:

โœ… If 'allergenTypeCode' (20) equals 'AW'...

Boolean Value Formattingโ€‹

Boolean values SHALL be expressed as:

  • 'true' for true conditions
  • 'false' for false conditions

Never use: 1/0, yes/no, Y/N

Example:

โœ… IF 'isTradeItemAConsumerUnit' (3066) equals 'true'...

โŒ IF 'isTradeItemAConsumerUnit' (3066) is set to 'true'...

Logical Operators and Comparisonsโ€‹

Standard Formatโ€‹

Use the following formats for logical operations and comparisons:

OperationFormat
Equal"equals"
Not Equal"is not equal to"
AND"AND" (all caps)
OR"OR" (all caps)
Greater Than"is greater than"
Less Than"is less than"

Examplesโ€‹

Avoid synonyms:

โœ… IF 'dataCarrierTypeCode' equals 'EAN_8'...

โŒ IF 'dataCarrierTypeCode' is set to 'EAN_8'...

Compound Condition:

โœ… If 'tradeItemUnitDescriptorCode' (3074) is not equal to 'BASE_UNIT_OR_EACH' AND 'isTradeItemAConsumerUnit' (3066) equals 'true'...

Value List:

โœ… The value must be one of the following: 'AMBIENT', 'CHILLED', 'FROZEN', or 'OTHER'.

Cardinality and Quantifiersโ€‹

Standard Formatโ€‹

Use clear language to specify cardinality:

CardinalityFormatExample
Zero or more"may be indicated""The attribute 'additionalTradeItemDescription' may be indicated."
Exactly one"SHALL be indicated exactly once""The attribute 'countryOfOrigin' SHALL be indicated exactly once."
One or more"SHALL be indicated at least once""The attribute 'regulatedProductName' SHALL be indicated at least once."
None"SHALL NOT be indicated""The attribute 'serialNumberID' SHALL NOT be indicated for this type of item."

Examplesโ€‹

At Least One:

โœ… "'ingredientStatement' (816) with languageCode equal to 'da' SHALL be indicated at least once."

Exactly One:

โœ… "'ReturnablePackageDepositIdentification' (1777) SHALL be indicated exactly once."

Mathematical Operationsโ€‹

Use standard mathematical operators:

OperationOperatorExample
Multiplicationx(layerHeight x quantityOfCompleteLayersContainedInATradeItem)
Division/totalVolume / packageCount
Addition+baseHeight + platformHeight
Subtraction-endDate - startDate

Complex Example:

โœ… tradeItemMeasurements/height SHALL equal or be greater than ((layerHeight x quantityOfCompleteLayersContainedInATradeItem) + platform height)

Date and Time Referencesโ€‹

For date/time validations:

ComparisonCorrect TermExample
Earlier than"before""'endDate' is before 'startDate'"
Later than current"in the future""'expirationDate' is in the future"

Iteration Constraintsโ€‹

Use "maximum" when specifying limits on repetition:

Example:

โœ… A maximum of 3 instances of 'ingredientStatement' SHALL be provided per language.

Hierarchy Level Referencesโ€‹

Standard Formatโ€‹

When referencing hierarchy levels, use the following standard terms:

LevelStandard Term
Base Unit"base unit level" or "BASE_UNIT_OR_EACH"
Case"case level" or "CASE"
Pallet"pallet level" or "PALLET"
Display"display level" or "DISPLAY_SHIPPER"
Mixed Module"mixed module level" or "MIXED_MODULE"
Pack"pack level" or "PACK_OR_INNER_PACK"
Transport Load"transport load level" or "TRANSPORT_LOAD"

Examplesโ€‹

Specific Level:

โœ… "IF 'tradeItemUnitDescriptorCode' (3074) equals 'BASE_UNIT_OR_EACH', THEN The attribute 'netWeight' (3559) SHALL be indicated."

Multiple Levels:

โœ… "The attribute 'packagingTypeCode' SHALL be indicated for every unit within the hierarchy..."

Lists and Enumerationsโ€‹

Standard Formatโ€‹

When providing lists of values, codes, or options:

  1. For short lists (1-3 items), use commas and "or" in the text
  2. For longer lists (4+ items), use commas with the Oxford comma before "or" in brackets

Examplesโ€‹

Short List:

"...where 'productActivityTypeCode' value is set to 'BIRTH' or 'REARING'."

Longer List:

"The value must be one of the following: ('AMBIENT', 'CHILLED', 'FROZEN', or 'OTHER')."

Code Lists Referencesโ€‹

Standard Formatโ€‹

When referencing code lists:

the [CodeListName]

Examplesโ€‹

Proper Code List Reference:

"The 'riskPhraseCode' must have a value from the 'RiskPhraseCodeList'."

With Specific Values:

"The 'temperatureQualifierCode' (3614) must be set to 'STORAGE_HANDLING' from the 'TemperatureQualifierCodeList'."

GPC Referencesโ€‹

Standard Formatโ€‹

When referencing GPC brick codes or categories:

gpcCategoryCode (3122) [code or codes] ([optional description])
info

When defining the rule, the GPC setup is configured in Duplex Sync, so there is no need to reference it directly in the rule definition. However, you can reference GPC categories or bricks in your rules for clarity.

Examplesโ€‹

Single GPC Brick:

"IF gpcCategoryCode (3122) is set to 10000028 (Cheese - Hard)..."

Multiple GPC Bricks:

"IF gpcCategoryCode (3122) is set to one of the following: 10000028, 10000029 or 10000030 (Cheese categories)."

Target Market Referencesโ€‹

Standard Formatโ€‹

When referencing target markets:

Target Market [code] ([country name])
info

When defining the rule, the Target Market setup is configured in Duplex Sync, so there is no need to reference it directly in the rule definition. However, you can reference Target Market in your rules for clarity.

Examplesโ€‹

Single Target Market:

"IF Target Market '208' (Denmark) is selected."

Multiple Target Markets:

"IF Target Market is set to '208' (Denmark), '752' (Sweden) OR '578' (Norway)."

Advanced Formatting Rulesโ€‹

Bracket Usageโ€‹

Use brackets to improve readability in complex expressions:

Example:

IF (isTradeItemPackedIrregularly equals 'false' or is not used)
AND trade item is at top level
AND layerHeight is used
AND nestingIncrement is not used
THEN tradeItemMeasurements/height SHALL equal or be greater than
((layerHeight x quantityOfCompleteLayersContainedInATradeItem) + platform height)

Language/Unit/Currency Repeatabilityโ€‹

For attributes that can repeat for different languages, units, or currencies, specify exactly which instances are affected:

Examples:

โœ… 'regulatedProductName' (3314) with languageCode 'da' SHALL be provided

โœ… 'netWeight' with measurementUnitCode 'GRM' or 'KGM' SHALL be used

Paired/Grouped Attributesโ€‹

When attributes work in pairs or groups, clearly specify the relationship:

Example:

โœ… IF 'minimumTemperature' is used, THEN 'maximumTemperature' SHALL also be used with the same measurementUnitCode

Rule Sequence Requirementsโ€‹

Rules SHALL follow a logical sequence addressing:

  1. Target Market constraints first
  2. Product (GPC) constraints second
  3. Business context constraints last

Example Sequence:

IF targetMarketCountryCode equals '208' (Denmark)
AND gpcCategoryCode (3122) is in (10000144, 10000145)
AND isTradeItemAConsumerUnit equals 'true'
THEN countryOfOrigin (3068) SHALL be used

By following these formatting standards, you'll create Duplex Sync rules that are visually consistent, technically accurate, and easier to parse for both human readers and automated systems.