What is the "Logic" dropdown option on Data Source Configuration used for?
Question
On the creation screen of a Data Source, there is a drop-down box where you can select a "PriceAnalyzer" logic type. What is it?
Answer
This is a transformation logic - similar to the one in Data Load Flush operation. It is a logic used to transform data already in the Data Source.
You can make elements in the logic with Context "Init" and in this case, loop through results of api.getDatamartRowSet("target"). Using this strategy, you can update rows with target.addRow(rowMap).
Alternatively you can make elements with the context "Row", and access the individual row info using api.getUserEntry("ColumnName"), and output the result back to the column by "return"ing my transformed result from an element with the name of the column I wish to transform.
It is triggered when data is loaded in a Data Source, either through a file upload, or a flush from a Data Feed.
I was able to get this working without any issues when using the Init-level approach only. This involved pulling rows from the "source" (using api.getDatamartRowSet("source")), modifying them and then adding them to the target set (using target.addRow as suggested). Critically when you do this, you must use <source>.next() to iterate on the rows in the Init-level logic.
I wasn't able to get a row-by-row approach working. It doesn't look like "api.getUserEntry" is a valid method. I tried getParameter, input and currentItem and none of those returned anything at the row level either. It could have been that I needed to iterate on the row set differently, but I couldn't sort out how to do that.
The Init level approach worked like a charm. That implementation could get a little ugly for more complex enrichments, though.