Click or drag to resize

Gs1ElementString Class

A GS1 Element String, which is an ordered list of GS1 Application Identifiers (AIs), each of which is a specific data element. A GS1 Element string is an abstract representation of the application data content of a bar code or RFID tag conforming to GS1 standards.

In the bar code representation of GS1 Element String data, the order of AIs must conform to certain rules, namely that certain AIs of pre-defined size (as specified in the GS1 General Specifications) must occur first. The BarCodeCharacters property rearranges the order of AIs as necessary to accomplish this.

In the RFID representation of GS1 Element String data, different AIs are written to different RFID memory banks. In particular, the RFID EPC bank may only contain one of the following AI combinations:
EPC SchemeAIs
SGTINGTIN (AI 01) + SERIAL (AI 21)
SSCCSSCC (AI 00)
SGLNGLN (AI 414), with or without GLN Extension (AI 254)
GRAIGRAI (AI 8003) that includes the optional serial number
GIAIGIAI (AI 8004)
GDTIGDTI (AI 253) that includes the optional serial number
GSRNGSRN-Recipient (AI 8018)
GSRNPGSRN-Provider (AI 8017)
CPICPID (AI 8010) + CPID SERIAL (AI 8011)
SGCNGCN (AI 255) that includes the optional serial number
GINCGINC (AI 401)
GSINGSIN (AI 402)
ITIPITIP (AI 8006) + SERIAL (AI 21)
All AIs may be written to the RFID User Memory bank. Therefore, if a GS1 Element String contains none of the above AI combinations, then it can only be converted to a RfidUserBank instance containing all of the AIs in the GS1 Element String. If a GS1 Element String contains exactly one of the above AI combinations, then that AI combination can be converted to an Epc instance, and the remaining AIs converted to a RfidUserBank instance. If a GS1 Element String contains two or more of the above AI combinations, then the application must specify which combination is to be converted to an Epc instance, with the remainder being converted to a RfidUserBank instance. The toEpc and toRfidUserBank methods take arguments that guide which AI(s) are to be converted to EPC form or User Memory form.

In addition, to convert one of the above AI combinations to an EPC the application must specify the number of digits in the GS1 Company Prefix embedded within the AI. The methods take an argument to provide this.

Inheritance Hierarchy
SystemObject
  GS1.EPC.ApiGs1ElementString

Namespace: GS1.EPC.Api
Assembly: epc-epconly (in epc-epconly.dll) Version: 2.1.0.28145 (2.1.0.0)
Syntax
C#
public class Gs1ElementString

The Gs1ElementString type exposes the following members.

Properties
 NameDescription
Public propertyAis Returns the GS1 Application Identifiers (AIs) in this GS1 Element String.
Public propertyBarCodeCharacters Returns the string of characters representing this GS1 element string as it would be represented within a bar code. Each AI is represented by the AI number (with no parentheses) followed by the value. Fixed-length AIs come before variable-length AIs, and each variable-length AI except the last is followed by a GS separator character (the character whose code is 29 decimal).
Top
Methods
 NameDescription
Public methodEquals Test equality with another object
(Overrides ObjectEquals(Object))
Public methodStatic memberFromAis Constructs a Gs1ElementString instance from the specified AIs.
Public methodStatic memberFromBarCodeCharacters(String) Constructs a Gs1ElementString instance from the specified bar code representation. In the bar code representation, there are no whitespace characters, and each AI is written as its AI number followed immediately by its value. Each variable length AI except the last must be followed by a GS character (the character whose code is 29 in decimal).
Public methodStatic memberFromBarCodeCharacters(String, Char)

Constructs a Gs1ElementString instance from the specified bar code representation, using a specified separator character for variable-length AIs. In the bar code representation, there are no whitespace characters, and each AI is written as its AI number followed immediately by its value. Each variable length AI except the last must be followed by the specified separator character.

The input string may optionally contain a three-character bar code symbology identifier beginning with a right square bracket (]) character. The recognized symbology identifiers are as follows:
Symbology IdentifierComments
]E0EAN-13 having 13 digits. This is converted to a GS1 Element String containing AI 01 with the value zero padded to 14 digits.
]E4EAN-8 having 8 digits. This is converted to a GS1 Element String containing AI 01 with the value zero padded to 14 digits.
]I1ITF-14 having 14 digits. This is converted to a GS1 Element String containing AI 01.
]C1GS1-128 containing a concatenated GS1 Element String. The symbology identifier is stripped off and the remaining characters processed as described above.
]e0GS1 DataBar containing a concatenated GS1 Element String. The symbology identifier is stripped off and the remaining characters processed as described above.
]d2GS1 DataMatrix containing a concatenated GS1 Element String. The symbology identifier is stripped off and the remaining characters processed as described above.

Public methodStatic memberFromHumanReadable Constructs a Gs1ElementString instnace from the specified human readable representation.
Public methodGetHashCode Returns hash code of current object
(Overrides ObjectGetHashCode)
Public methodGetHumanReadable Returns a human-readable string representing this GS1 element string. Each AI is represented by the AI number in parentheses followed by the value.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToEpc(GcpLengthTable) Returns an Epc instance corresponding to the AIs in this GS1 element string that can be interpreted as an EPC. This element string must contain exactly one set of AIs that can be interpreted as an EPC, namely one of the following combinations:
  • GTIN (AI 01) + SERIAL (AI 21)
  • SSCC (AI 00)
  • GLN (AI 414)
  • GLN (AI 414) + GLN Extension (AI 254)
  • GRAI (AI 8003) that includes the optional serial number
  • GIAI (AI 8004)
  • GDTI (AI 253) that includes the optional serial number
  • GSRN-Recipient (AI 8018)
  • GSRN-Provider (AI 8017)
  • CPID (AI 8010) + CPID SERIAL (AI 8011)
  • GCN (AI 255) that includeds the optional serial number
  • GINC (AI 401)
  • GSIN(AI 402)
  • ITIP(AI 8006) + SERIAL(AI 21)
This element string may contain other AIs, but not more than one of the combinations listed above.
Public methodToEpc(Int32) Returns an Epc instance corresponding to the AIs in this GS1 element string that can be interpreted as an EPC. This element string must contain exactly one set of AIs that can be interpreted as an EPC, namely one of the following combinations:
  • GTIN (AI 01) + SERIAL (AI 21)
  • SSCC (AI 00)
  • GLN (AI 414)
  • GLN (AI 414) + GLN Extension (AI 254)
  • GRAI (AI 8003) that includes the optional serial number
  • GIAI (AI 8004)
  • GDTI (AI 253) that includes the optional serial number
  • GSRN-Recipient (AI 8018)
  • GSRN-Provider (AI 8017)
  • CPID (AI 8010) + CPID SERIAL (AI 8011)
  • GCN (AI 255) that includeds the optional serial number
This element string may contain other AIs, but not more than one of the combinations listed above.
Public methodToEpc(GcpLengthTable, EpcScheme) Returns an Epc instance having the specified EPC scheme, derived from the corresponding AIs in this GS1 element string. This element string must contain the AI or AIs corresponding to the specified EPC scheme as follows:
EPC SchemeAIs
SGTINGTIN (AI 01) + SERIAL (AI 21)
SSCCSSCC (AI 00)
SGLNGLN (AI 414), with or without GLN Extension (AI 254)
GRAIGRAI (AI 8003) that includes the optional serial number
GIAIGIAI (AI 8004)
GDTIGDTI (AI 253) that includes the optional serial number
GSRNGSRN-Recipient (AI 8018)
GSRNPGSRN-Provider (AI 8017)
CPICPID (AI 8010) + CPID SERIAL (AI 8011)
SGCNGCN (AI 255) that includes the optional serial number
GINCGINC (AI 401)
GSINGSIN (AI 402)
ITIPITIP (AI 8006) + SERIAL (AI 21)
This element string may contain other AIs; they are ignored.
Public methodToEpc(GcpLengthTable, EpcScheme) Returns an Epc instance having one of the specified EPC schemes, derived from the corresponding AIs in this GS1 element string. The EPC scheme of the result will be the scheme having the least index in the specified array, such that this element string contains the AI(s) required to construct an EPC of that scheme. This element string may contain other AIs apart from the AI(s) used to construct the result; they are ignored.
Public methodToEpc(Int32, EpcScheme) Returns an Epc instance having the specified EPC scheme, derived from the corresponding AIs in this GS1 element string. This element string must contain the AI or AIs corresponding to the specified EPC scheme as follows:
EPC SchemeAIs
SGTINGTIN (AI 01) + SERIAL (AI 21)
SSCCSSCC (AI 00)
SGLNGLN (AI 414), with or without GLN Extension (AI 254)
GRAIGRAI (AI 8003) that includes the optional serial number
GIAIGIAI (AI 8004)
GDTIGDTI (AI 253) that includes the optional serial number
GSRNGSRN-Recipient (AI 8018)
GSRNPGSRN-Provider (AI 8017)
CPICPID (AI 8010) + CPID SERIAL (AI 8011)
SGCNGCN (AI 255) that includes the optional serial number
GINCGINC (AI 401)
GSINGSIN (AI 402)
ITIPITIP (AI 8006) + SERIAL (AI 21)
This element string may contain other AIs; they are ignored.
Public methodToEpc(Int32, EpcScheme) Returns an Epc instance having one of the specified EPC schemes, derived from the corresponding AIs in this GS1 element string. The EPC scheme of the result will be the scheme having the least index in the specified array, such that this element string contains the AI(s) required to construct an EPC of that scheme. This element string may contain other AIs apart from the AI(s) used to construct the result; they are ignored.
Public methodToRfidUserBank(Boolean) Returns an RfidUserBank instance containing some or all of the AIs in this GS1 element string.

If includeAllAis is true, then all AIs in the element string are included in the result, even AIs that could be converted to an EPC.

If includeAllAis is false, then the AI(s) corresponding to an EPC are omitted from the result. AI(s) corresponding to an EPC are one of the following combinations:

  • GTIN (AI 01) + SERIAL (AI 21)
  • SSCC (AI 00)
  • GLN (AI 414)
  • GLN (AI 414) + GLN Extension (AI 254)
  • GRAI (AI 8003) that includes the optional serial number
  • GIAI (AI 8004)
  • GDTI (AI 253) that includes the optional serial number
  • GSRN-Recipient (AI 8018)
  • GSRN-Provider (AI 8017)
  • CPID (AI 8010) + CPID SERIAL (AI 8011)
  • GCN (AI 255) that includes the optional serial number
  • ITIP (AI 8006) + SERIAL (AI 21)
If this element string contains none of the above combinations, then all AI(s) are included in the result. If this element string contains exactly one of the above combinations, then that combination is omitted from the result and all other AI(s) are included. If this element string contains two or more of the above combinations, then a Gs1Exception is thrown.

Equivalently, ToRfidUserBank(false) returns an RfidUserBank instance that includes all AIs except the AIs that would be included in the result of ToEpc(gcpLength), if the latter method would not raise an exception due to having more than one candidate EPC.

Public methodToRfidUserBank(EpcScheme) Returns an RfidUserBank instance containing the AIs in this GS1 element string except for the AI(s) corresponding to the specified EPC scheme. This element string must contain the AI or AIs corresponding to the specified EPC scheme as follows:
EPC SchemeAIs
SGTINGTIN (AI 01) + SERIAL (AI 21)
SSCCSSCC (AI 00)
SGLNGLN (AI 414), with or without GLN Extension (AI 254)
GRAIGRAI (AI 8003) that includes the optional serial number
GIAIGIAI (AI 8004)
GDTIGDTI (AI 253) that includes the optional serial number
GSRNGSRN-Recipient (AI 8018)
GSRNPGSRN-Provider (AI 8017)
CPICPID (AI 8010) + CPID SERIAL (AI 8011)
SGCNGCN (AI 255) that includes the optional serial number
ITIPITIP (AI 8006) + SERIAL (AI 21)
Equivalently, ToRfidUserBank(scheme) returns an RfidUserBank instance that includes all AIs except the AI(s) that would be included in the result of ToEpc(gcpLength, scheme), if the latter method would not raise an exception.
Public methodToRfidUserBank(EpcScheme) Returns an RfidUserBank instance containing the AIs in this GS1 element string except for the AI(s) corresponding to one of the specified EPC schemes. The AI(s) omitted from the result will be those corresponding to the EPC scheme having the least index in the specified array, such that this element string contains the AI(s) required to construct an EPC of that scheme.

Equivalently, ToRfidUserBank(preferredSchemes) returns an RfidUserBank instance that includes all AIs except the AI(s) that would be included in the result of toEpc(preferredSchemes), if the latter method would not raise an exception.

Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Fields
 NameDescription
Public fieldStatic memberGS1_AI_DATA_FORMAT_NUMBER The ISO Data Format number for GS1 AIs.
Public fieldStatic memberGS1_AI_ROOT_OID The root OID for GS1 AIs: {1 0 15961 9} (urn:oid:1.0.15961.9)
Top
See Also