如何使用impex在Hybris中仅导出一种产品

如何使用impex在Hybris中仅导出一种产品,hybris,impex,Hybris,Impex,我只想使用hybris impex出口一种产品: 下面的sql为我提供了该产品 select * from products where code='489923' 我正在尝试修改导出脚本: # ---- Extension: core ---- Type: Product ---- "#% impex.setTargetFile( ""Product.csv"" );" insert_update Product;pk;Europe1PriceFactory_PDG(code,itemtyp

我只想使用hybris impex出口一种产品: 下面的sql为我提供了该产品

select * from products where code='489923'
我正在尝试修改导出脚本:

# ---- Extension: core ---- Type: Product ----
"#% impex.setTargetFile( ""Product.csv"" );"
insert_update Product;pk;Europe1PriceFactory_PDG(code,itemtype(code));Europe1PriceFactory_PPG(code,itemtype(code));Europe1PriceFactory_PTG(code,itemtype(code));approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];code[unique=true,allownull=true];contentUnit(code);creationtime[forceWrite=true,dateformat=dd.MM.yyyy hh:mm:ss];data_sheet(catalogVersion(catalog(id),version),code);deliveryTime;description[lang=en];detail(catalogVersion(catalog(id),version),code);ean;endLineNumber;erpGroupBuyer;erpGroupSupplier;europe1Discounts(pk);europe1Prices(pk);europe1Taxes(pk);galleryImages(catalogVersion(catalog(id),version),qualifier);logo(catalogVersion(catalog(id),version),code);manufacturerAID;manufacturerName;manufacturerTypeDescription[lang=en];maxOrderQuantity;minOrderQuantity;name[lang=en];normal(catalogVersion(catalog(id),version),code);numberContentUnits;offlineDate[dateformat=dd.MM.yyyy hh:mm:ss];onlineDate[dateformat=dd.MM.yyyy hh:mm:ss];order;orderQuantityInterval;others(catalogVersion(catalog(id),version),code);owner(pk)[allownull=true];picture(catalogVersion(catalog(id),version),code);priceQuantity;productOrderLimit(pk);remarks[lang=en];segment[lang=en];sequenceId;specialTreatmentClasses();startLineNumber;summary[lang=en];supplierAlternativeAID;thumbnail(catalogVersion(catalog(id),version),code);thumbnails(catalogVersion(catalog(id),version),code);unit(code);variantType(code);variants(catalogVersion(catalog(id),version),code);xmlcontent
"#% impex.exportItems( ""Product"" , false );"
详情如下:

# ---- Extension: core ---- Type: Product ----
"#% impex.setTargetFile( ""Product.csv"" );"
insert_update Product;pk;Europe1PriceFactory_PDG(code,itemtype(code));Europe1PriceFactory_PPG(code,itemtype(code));Europe1PriceFactory_PTG(code,itemtype(code));approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];code[unique=true,allownull=true];contentUnit(code);creationtime[forceWrite=true,dateformat=dd.MM.yyyy hh:mm:ss];data_sheet(catalogVersion(catalog(id),version),code);deliveryTime;description[lang=en];detail(catalogVersion(catalog(id),version),code);ean;endLineNumber;erpGroupBuyer;erpGroupSupplier;europe1Discounts(pk);europe1Prices(pk);europe1Taxes(pk);galleryImages(catalogVersion(catalog(id),version),qualifier);logo(catalogVersion(catalog(id),version),code);manufacturerAID;manufacturerName;manufacturerTypeDescription[lang=en];maxOrderQuantity;minOrderQuantity;name[lang=en];normal(catalogVersion(catalog(id),version),code);numberContentUnits;offlineDate[dateformat=dd.MM.yyyy hh:mm:ss];onlineDate[dateformat=dd.MM.yyyy hh:mm:ss];order;orderQuantityInterval;others(catalogVersion(catalog(id),version),code);owner(pk)[allownull=true];picture(catalogVersion(catalog(id),version),code);priceQuantity;productOrderLimit(pk);remarks[lang=en];segment[lang=en];sequenceId;specialTreatmentClasses();startLineNumber;summary[lang=en];supplierAlternativeAID;thumbnail(catalogVersion(catalog(id),version),code);thumbnails(catalogVersion(catalog(id),version),code);unit(code);variantType(code);variants(catalogVersion(catalog(id),version),code);xmlcontent
"#% impex.exportItems(""SELECT {K:pk} FROM {Product as K} WHERE {K:code}='489923'  , false );"

所以我只能出口一种产品。但它给了我错误?另外,我不确定如何查看错误的详细信息。

当您尝试调用函数exportItems时,您的impex文件中有一个错误

根据您的Hybris版本,exportItems函数有多种形式:

    // since 3.1-RC
    public void exportItemsFlexibleSearch( String query )
    public void exportItemsFlexibleSearch( String query, Map values, List resultClasses, final boolean failOnUnknownFields, final boolean dontNeedTotal, int start, int count )
    // since 3.1-u6
    public void exportItemsFlexibleSearch( String query, int count )
就我而言,我使用seconde表单出口产品:

"#% impex.exportItems( ""select {K.pk} from {Product K}"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
亚当,在引用时要小心:

      "#% impex.exportItems(""SELECT {K:pk} FROM {Product as K} WHERE {K:code}='489923'  , false );"

您可以在hac中运行以下导出impex:

insert_update Product;pk;approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];
"#% impex.exportItemsFlexibleSearch( ""select {pk},{approvalStatus},{articleStatus},{buyerIDS},{catalog},{catalogVersion}from {Product} where {pk}='8799737217054'"" );"

您可以在下面下载一个文件

谢谢您的帮助。我尝试了上面的脚本,但仍然得到以下错误:16.01.11 07:10:23:256主脚本第5行错误:执行第5行代码时出错:源文件:内联求值:`impex.exportItemsSELECT{K:pk}FROM{Product as K},其中{K:code}='489923'。令牌解析错误:第1行第89列的词法错误。遇到:之后:\SELECT{K:pk}FROM{Product as K},其中{K:code}=\'489923\',false;我正在使用4.8版本。请尝试以下代码:-扩展名:核心类型:产品-%impex.setTargetFile Product.csv;插入更新产品;pk%impex.exportItems从{Product AS K}中选择{K.pk},Collections.EMPTY_映射,Collections.singletonList Item.class,true,true,-1,-1;