/
How to Use "Incremental" with Feeder Logic
How to Use "Incremental" with Feeder Logic
If you're trying to use a Feeder Logic to emit items to a Data Load, you'll notice that the "Incremental" checkbox has no effect by default.
Setting this checkbox does, however, set some properties, which can then be used for emitting items which are more recently updated than the incremental date.
For an example on how to use incremental with a Data Feed, see below code snippet, which will emit all price list items, sorted by most recent update date, from the price list ID 999:
feedObjects("PLI", Filter.equal("pricelistId", 999), "-lastUpdateDate")
void feedObjects(String typeCode, Filter filter = null, String sortBy = null, Boolean supportIncremental = true) {
List<Number> ids = getObjectIds(typeCode, filter, sortBy, supportIncremental)
for (id in ids) {
api.emitPersistedObject(typeCode, id)
}
}
List<Number> getObjectIds(String typeCode, Filter filter = null, String sortBy = null, Boolean supportIncremental = true){
if(supportIncremental)
filter = getIncrementalFilter(filter)
def stream = api.stream(typeCode, sortBy ?: "-lastUpdateDate", ["id"], filter)
List<Number> ids = stream?.collect { it.id }
stream?.close()
return ids
}
Filter getIncrementalFilter(Filter filter = null){
if (api.currentItem("incremental") as Boolean) {
Filter timeFilter = Filter.greaterOrEqual("lastUpdateDate", api.currentItem("incCalculationDate") ?: api.currentItem("incLoadDate"))
if (filter)
filter = Filter.and(filter, timeFilter)
else
filter = timeFilter
}
return filter
}
, multiple selections available,
Related content
Performance Use Cases - Lessons Learned / Dos and Don'ts
Performance Use Cases - Lessons Learned / Dos and Don'ts
Read with this
pfx-api:flush
pfx-api:flush
More like this
Regular Calculation Dataload Logic
Regular Calculation Dataload Logic
Read with this
I cannot delete row from Data Source via Data Load with deleteRow(Map)
I cannot delete row from Data Source via Data Load with deleteRow(Map)
Read with this
What is the "Logic" dropdown option on Data Source Configuration used for?
What is the "Logic" dropdown option on Data Source Configuration used for?
Read with this
Found an issue in documentation? Write to us.