1
votes

I am trying to Export Data from multiple tables through Export Impex script but not able to define headers for multiple tables. Hierarchy is something like: OrderTable>>OrderEntry>>UNIT>PRODUCTID

Can anyone suggest how can I achieve this.

"#% 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 );"
1
Would you please be able to post the ImpEx script you are using? It's hard to tell where you are going wrong without seeing the scriptGrinch91
Hey I wrote the script to export data from HMC but it can export only data only from one single table. Look at the impex file now i want to join two or more than two tables to export data.shitanshu

1 Answers

1
votes

Your query is throwing error, for that reason your export is failing.

Try with following query,

select {pk} from {Order as o}, {Currency as c} where {o.currency} = {c.pk} and {c.isocode} IN ('NOK','DKK','EUR','SEK')

Here is another example for exporting from impex export for your reference.

"#% 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 );"