| Apostrophe Systems EPC Generator 2.0 |
|
EPCBase.Parse Method
Parses an EPC Value and returns an instance of the appropriate EPC Type GID, SSCC , SGTIN etc.
Parameters
-
epcNumber
- An EPC Number in either HEX, BINARY, or EPC Tag URI format
Return Value
An EPCBase instance
Remarks
Sometimes it is useful to parse an encoded EPC Number. Reasons for doing this include
-
Getting a URI. Either a Tag URI or Pure Identity URI
-
Listing the fields of the EPC Number
-
Checking individual field values of the EPC Number
-
Placing a Tag URI into a programmable format such as HEX
If a 64 Bit EPC Number is parsed the EPC Generator will be unable to automatically provide a PureIdentity. This is because the 64 Bit EPC Number contains a Company Prefix Index and not a Company Prefix, as required by the Pure Identity URI. The EPC Generator API must translate the Company Prefix into a Company Prefix Index. EPC Global will issue a Managing Entity a Company Prefix Index and store this value in a Translation Table. The EPC Generator can be configured to use this Translation Table to resolve the Company Prefix/Company Prefix Indicies. If you wish to use 64-Bit EPC Numbers but do not have an EPC Global issued Company Prefix Index, you can configure the Company Prefix Index/Company Prefix pair in the host application's .config file. see
EPCConfiguration Company Prefix Index/Company Prefix pairs configured in the config file are not considered legal. Please contact EPC Global for your Company Prefix Index. Another option the caller has if Pure Identity is required from a 64-Bit EPC Number, is to use the
Encode Methods to build the EPC Number first then set the Company Prefix usng
SetFieldValue after the call to
Parse() and before calling
ToPureIdentity. See Example.
Example
This Example parses a 64 Bit SGTIN
//Parse the EPC Number
SGTIN parsedSGTIN = (SGTIN)EPCBase.Parse("980020003E0003E8");
//Calling ToPureIdentity here will raise an exception because this is a 64-Bit EPC Number and it does not contain a company prefix
//So set the Company Prefix prior to calling ToPureIdentity
parsedSGTIN.SetFieldValue("CompanyPrefix","0652642");
//Now you can call ToPureIdentity
Console.Write(parsedSGTIN.ToPureIdentity());
See Also
EPCBase Class | Apostrophe.EPC Namespace