The method api.productExtension() has been deprecated in 14.0 version.
Deprecated Usage
Retrieves a list of rows from a Product Extension (PX) table named extensionName for the SKU being calculated (SKU in the context).
def date = new Date().format("yyyy-MM-dd")
def pxFilter = [
Filter.lessOrEqual("attribute4", date),
Filter.greaterOrEqual("attribute5", date),
]
def pxCosts = api.productExtension("Costs", *pxFilter)
Result
|
version |
typedId |
name |
sku |
createDate |
createdBy |
lastUpdateDate |
lastUpdateBy |
attribute1 |
attribute2 |
attribute3 |
attribute4 |
attribute5 |
|
1 |
164.PX20 |
Costs |
10000001 |
2025-02-06T07:59:14 |
740 |
2025-02-10T14:30:02 |
740 |
0001 |
2024-12-01 |
2025-12-31 |
49 |
GBP |
|
1 |
140164.PX20 |
Costs |
10000001 |
2025-02-06T07:59:50 |
740 |
2025-02-10T14:30:02 |
740 |
0002 |
2024-12-01 |
2025-12-31 |
78 |
GBP |
|
1 |
280164.PX20 |
Costs |
10000001 |
2025-02-06T08:00:26 |
740 |
2025-02-10T14:30:02 |
740 |
0003 |
2024-12-01 |
2025-12-31 |
29 |
CZK |
|
1 |
420164.PX20 |
Costs |
10000001 |
2025-02-06T08:01:03 |
740 |
2025-02-10T14:30:02 |
740 |
0004 |
2024-12-01 |
2025-12-31 |
74 |
USD |
|
1 |
560164.PX20 |
Costs |
10000001 |
2025-02-06T08:01:39 |
740 |
2025-02-10T14:30:02 |
740 |
0005 |
2024-12-01 |
2025-12-31 |
28 |
CZK |
QueryApi Usage
def qapi = api.queryApi()
def exprs = qapi.exprs()
def date = new Date()
def t1 = qapi.tables().productExtensionRows("Costs")
def sku = api.currentItem("sku")
def pxCosts = qapi.source(t1, [t1.sku(),
t1.SalesOrg,
t1.Cost,
t1.Currency,
], exprs.and(
t1.sku().equal(sku),
t1.ValidFrom.lessOrEqual(date),
t1.ValidTo.greaterOrEqual(date),
))
.stream { it.collect { it } }
Result
|
sku |
SalesOrg |
Cost |
Currency |
|
10000001 |
0001 |
49 |
GBP |
|
10000001 |
0002 |
78 |
GBP |
|
10000001 |
0003 |
29 |
CZK |
|
10000001 |
0004 |
74 |
USD |
|
10000001 |
0005 |
28 |
CZK |