我正在尝试通过Export Impex脚本从多个表导出数据,但无法为多个表定义标头。层次结构类似于: OrderTable>>订单条目>>单元> PRODUCTID
任何人都可以建议我如何实现这一目标。
"#% impex.setTargetFile( ""Orders.csv"" );"
insert_update Order;code[unique=true];purchaseOrderNumber;sapOrderNumber;site(uid);date;subtotal;currency(isocode);soldto(uid);user(uid);salesdistrict(uid);
"#% impex.exportItems(""select {pk} from {order} where {currency} IN ({{select {pk} from {currency} where {isocode} IN ('NOK','DKK','EUR','SEK')}})"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
答案 0 :(得分:1)
您的查询抛出错误,因此您的导出失败。
尝试以下查询,
select {pk} from {Order as o}, {Currency as c} where {o.currency} = {c.pk} and {c.isocode} IN ('NOK','DKK','EUR','SEK')
这里是从impex导出进行导出的另一个示例,供您参考。
"#% impex.setTargetFile( ""Category.csv"" );"
insert_update Category;&Item;ambassadorDesc;catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];code[unique=true,allownull=true];data_sheet(catalogVersion(catalog(id),version),code);defaultSku;description[lang=en];description[lang=en_GB];description[lang=en_US];detail(catalogVersion(catalog(id),version),code);logo(catalogVersion(catalog(id),version),code);name[lang=en];name[lang=en_GB];name[lang=en_US];normal(catalogVersion(catalog(id),version),code);order;others(catalogVersion(catalog(id),version),code);picture(catalogVersion(catalog(id),version),code);stockLevelThreshold;thumbnail(catalogVersion(catalog(id),version),code);thumbnails(catalogVersion(catalog(id),version),code)
"#% impex.exportItems( ""Select {cat.pk} from {Category as cat join Catalog as c on {cat.catalog}={c.PK}} where {c.id}='masterProductCatalog'"" , Collections.EMPTY_MAP, Collections.singletonList (Item.class) , true, true, -1, -1 );"