天天看點

SAP Commerce Impex文法

SAP Commerce Impex文法

Header:上圖藍色和淺綠色文字。

A header is a single line defining a mapping of the following value lines to the type system. A header applies to all processed value lines until the next header or until the end of file, whichever comes first. You can put any number of headers into a CSV file.

定義了接下來value line和type系統的映射關系。

格式:

mode type[modifier=value];attribute[modifier=value];attribute[modifier=value];attribute[modifier=value][;...];attribute[modifier=value]      

方框裡的modifier:Gives additional information for translating a value record to the mapped type attribute

例子:INSERT_UPDATE

category;code[unique=true];name[lang=de];name[lang=en];$supercategories;$thumbnail;description[lang=de];order      

This header states that each following value line creates or updates a category instance, until another header occurs. 注意,大小寫無關。

INSERT Address;firstname;owner(Principal.uid|AbstractOrder.code)
;Hans;admin
;Klaus;O-K2006-C0000-001      

由|分隔開的文法叫 alternative pattern.

When importing the first value line ;Hans;admin, the ImpEx extension searches all instances of the Principal type to verify if any instance exists where the uid attribute is set to admin.

Impex extension首先查找所有principal執行個體,看是否存在其uid屬性值為admin的執行個體。

注意我們現在是試圖插入Address資料,如果上述的搜尋命中,則将Impex語句裡的address值維護到搜尋命中的admin Principal執行個體去。

If an instance exists (and there is, by platform default), the new instance of the Address type has its owner attribute set to a reference to that Principal type instance.

如果并沒有Principal執行個體,其uid屬性等于admin,那麼進行第二輪搜尋,根據AbstractOrder的code字段進行搜尋。

Attribute modifier

…;attribute[modifier=value,modifier=value,modifier=value];…

或者

…;attribute[modifier=value][modifier=value][modifier=value];…

The value of the $catalog macro sets the catalog id. The value of the $version macro sets the version string of the catalog version to export.

$catalog=clothescatalog

$version=Staged

宏的實作:

$catalog=catalog(id)

c a t a l o g V e r s i o n = c a t a l o g V e r s i o n ( catalogVersion=catalogVersion(catalogVersion=catalogVersion(catalog,version)

繼續閱讀