on 02-20-2023 8:53 PM
Below export script is working.
"#% impex.setTargetFile( ""cartentry.csv"" );"
insert_update cartentry;order(code);order(creationtime);order(modifiedtime); order(user(uid))[alias=siteId];order(user(name))[alias=name];order(deliveryAddress(email))[alias=email] ;order(deliveryAddress(phone1))[alias=phone];
"#% impex.exportItemsFlexibleSearch( ""Select {pk} from {cartentry as e join cart as o on {e.order}={o.pk} join Customer as c on {c.pk} = {o.user} join Address as a on {o.deliveryaddress} = {a.pk} join CMSSite as s on {s.pk}={o.site} join TmaProductOffering as p on {e.product}={p.pk} JOIN CatalogVersion as cat on {p.catalogVersion}={cat.pk} JOIN EnumerationValue as en on {en.pk}={p.poType}} where {cat.version}='Online' AND ({a.email} is NOT NULL OR {a.phone1} is NOT NULL) AND {s.uid} = 'sunriseUpc' AND {e.bpo} is NULL AND {o.creationtime} >= '2023-02-01 00:00:00' ORDER BY {o.creationtime} "" );"
However below one is not working.
"#% impex.setTargetFile( ""cartentry.csv"" );"
insert_update cartentry;order(code);order(creationtime);order(modifiedtime); order(user(uid))[alias=siteId];order(user(name))[alias=name];order(deliveryAddress(email))[alias=email] ;order(deliveryAddress(phone1))[alias=phone];product(potype(code,itemtype(code)))[alias=potype];
"#% impex.exportItemsFlexibleSearch( ""Select {pk} from {cartentry as e join cart as o on {e.order}={o.pk} join Customer as c on {c.pk} = {o.user} join Address as a on {o.deliveryaddress} = {a.pk} join CMSSite as s on {s.pk}={o.site} join TmaProductOffering as p on {e.product}={p.pk} JOIN CatalogVersion as cat on {p.catalogVersion}={cat.pk} JOIN EnumerationValue as en on {en.pk}={p.poType}} where {cat.version}='Online' AND ({a.email} is NOT NULL OR {a.phone1} is NOT NULL) AND {s.uid} = 'sunriseUpc' AND {e.bpo} is NULL AND {o.creationtime} >= '2023-02-01 00:00:00' ORDER BY {o.creationtime} "" );"
<enumtype code="xyzPoType">
<value code="M_ORDER"/>
<value code="H_ORDER"/>
</enumtype>
<itemtype code="TmaProductOffering" autocreate="false" generate="false">
</itemtype>
While exporting getting below error.
ERROR line 4 at main script: unknown attributes [Product.poType] - cannot resolve item reference
Something wrong with the headers and not with query because below flexiquery is working.select {o.code} as cartId, {en.code} as poType, {c.name} as name, {c.uid} as siteId, {a.email} as email, {a.phone1} as phone, {o.creationtime} as creationtime, {o.modifiedtime} as modifiedtime from {Cart as o join Customer as c on {c.pk} = {o.user} join Address as a on {o.deliveryaddress} = {a.pk} join cartentry as e on {e.order}={o.pk} join CMSSite as s on {s.pk}={o.site} join TmaProductOffering as p on {e.product}={p.pk} JOIN CatalogVersion as cat on {p.catalogVersion}={cat.pk} JOIN EnumerationValue as en on {en.pk}={p.poType} } where {cat.version}='Online' AND ({a.email} is NOT NULL OR {a.phone1} is NOT NULL) AND {s.uid} = 'abc' AND {e.bpo} is NULL AND {o.creationtime} >= '2023-02-01 00:00:00'As PoType is from TmaProductOffering, and Product in CartEntry is Product type, you need to tell hybris to get it from TmaProductOffering, or to "cast" it, I post a question before about it, you can see it from this link.
Anyway, for you question, your impex should be:
insert_update cartentry;order(code);order(creationtime);order(modifiedtime); order(user(uid))[alias=siteId];order(user(name))[alias=name];order(deliveryAddress(email))[alias=email] ;order(deliveryAddress(phone1))[alias=phone];product(TmaProductOffering.potype(code,itemtype(code)))[alias=potype];
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Your header is trying to get poType from Product Type because of "product(potype(code,itemtype(code)))[alias=potype]".
It seems that potype is not there in product but it is in TmaProductOffering, hence you are getting the error. Note that product attribute in CartEntry is of type Product & not of type TmaProductOffering.
Hope this helps you in fixing the header.
Regards,
Romit Chhabra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.