...
In transactional database, the Groovy data type for an attribute field is determined by it’s configured Type:
...
Column Type | Groovy Data Type |
---|---|
String | java.lang.String |
Integer |
...
java.lang.Long | |
Real |
...
java.math.BigDecimal | |
Date |
...
java.time.LocalDate | |
Timestamp |
...
org.joda.time.DateTime | |
Boolean |
...
java.lang.Boolean | |
Link |
...
java.lang.String | |
Entity reference |
...
java.lang.String |
Note |
---|
QueryAPI converts the value using CAST in SQL. So if there is an issue with the data integrity (e.g. integration loaded a string value in an attribute field of type Integer) then the whole query call crashes. |
...
In analytical database, the Groovy data type for attribute field is determined by it’s configured Data Type:
Column Type | Groovy Data Type |
---|---|
Text |
...
java.lang.String | |
Currency | java.lang.String |
Integer |
...
java.lang.Long | |
Money |
...
java.math.BigDecimal | |
Number |
...
java.math.BigDecimal | |
Date |
...
java.time.LocalDate |
...
Timestamp | org.joda.time.DateTime |
Boolean |
...
java.lang.Boolean |
...
Currency → java.lang.String
Quantity | java.math.BigDecimal |
Source table
Source table is specified using source()
method is telling which table will be queried. If you are familiar with SQL language, you can look at this method as “FROM” clause in SQL.
...
Code Block | ||
---|---|---|
| ||
def date = new Date() def q = api.queryApi() def t1 = q.tables().products() def t2 = q.tables().productExtensionRows("Cost") return q.source(t1, [t1.sku(), t1.ProductGroup]) .leftOuterJoin(t2, { cols -> [t2.Cost, t2.Currency] }, { cols -> q.exprs().and( t2.sku().equal(cols.sku), t2.ValidFrom.lessOrEqual(date), t2.ValidTo.greaterOrEqual(date), ) } ) .stream { it.collect { it } } |
...