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 }

Found an issue in documentation? Write to us.