escaping special characters in impex file
When we insert data through impex, its sometime necessary to insert special characters as part of data.
When we provide these values in impex, impex can’t run it successfully.
Its mainly because impex has its own definition for semicolon and colon characters.
Semicolon in impex is field separator and colon is used for composite key.
How do we escape special meaning of these characters and insert those characters as part of data?
We can achieve this by using special delimiter called “path-delimiter”
We can use any character for path-delimiter to escape special characters
Consider below examples
Example 1
- $contentCatalog=electronics-ukContentCatalog
- $syncJob=sync $contentCatalog:Staged->Online
- INSERT_UPDATE SyncAttributeDescriptorConfig;syncJob(code)[default=synjobName][unique=true][path-delimiter=!];attributeDescriptor(enclosingType(code),qualifier)[unique=true];includedInSync;copyByValue[default=false];presetValue;translateValue[default=false];untranslatable[default=false]
- ;$syncJob;AbstractPage:originalPage;true
$contentCatalog=electronics-ukContentCatalog $syncJob=sync $contentCatalog:Staged->Online INSERT_UPDATE SyncAttributeDescriptorConfig;syncJob(code)[default=synjobName][unique=true][path-delimiter=!];attributeDescriptor(enclosingType(code),qualifier)[unique=true];includedInSync;copyByValue[default=false];presetValue;translateValue[default=false];untranslatable[default=false] ;$syncJob;AbstractPage:originalPage;true
Now when we run this impex, the value for syncJob(code) will be stored as
sync electronics-ukContentCatalog:Staged->Online
This is because, we are using path-delimiter =!
If we don’t use this path-delimiter then we would have got error as below
Example 2
- insert_update cmssite;uid[unique=true];defaultCatalog(id)[path-delimiter=!]
- ;myStore_site;myStore:catalog
insert_update cmssite;uid[unique=true];defaultCatalog(id)[path-delimiter=!] ;myStore_site;myStore:catalog
Now when we run this impex, hybris searches for catalog id with value as “myStore:catalog” exactly in the table.
If we don’t use path-delimiter then we will get error as below
Note : path-delimiter is Restricted to attributes of type ComposedType