Yes, your solution to generate label values from numeric values in Query expression editor (equivalent of decode SQL function) is probably enough for your need, easier and more understantable for not programmers, you are right; though it is often useful for a few values possible, otherwise it becomes quites unreadable because the Query expression editor doesn't support formatting styles (line breaks etc) so it is often misleading.
So if you do it frequently, you should define the replacement by a SQL User Function (see other posts and documentation about to proceed), in that way you will get a concise expression.
The main issue I see is that this is not dynamically change when there are products upgrades (builds can introduce new values of sysEnum). Anyway, please test numeric values not strings, take care to the right syntax.
Regarding the solution of double-pass for filling context objects, yes, it is more useful for adding more complex data than this sysEnum replacement. You can have a look into this report to see the idea of double-pass to add information in the context:
budgetEvolution But take time to have a look on many other reports that do more complex things, it is useful to understand possibilities of context manipulation. Most of time it is done in JS activity so you can notice them easily. But sometimes it is done directly in JS script inside the Page activity, such as:
in which you see the Expenses context enrichment in the script within the last Page activity of the report.
Enumeration format is unfortunately here for xtk:enum (itemized lists, node Administration>Platform>Enumerations (itemized lists) not for sysEnum (enumerations defined in schema, XML source schema).
And yes, you pointed out a limitation of Adobe Campaign for such report, with sysEnum values.
See for example this JS code to understand the JS function and object to use:
var schema = application.getSchema("nms:delivery")
for each(var e in schema.enumerations)
if (e.name == "nms:delivery:deliveryState")
for each(var v in e.values) // the .EnumerationValue is not to mention
logInfo(v.name + " = " + v.value)
In your case, you must loop on the ctx.query childs, (or whatever the collection you got, replace by rightname such as ctx["delivery-collection"] for instance), and append attribute value for the array of sysEnum you got by using the getSchema("nms:delivery").enumerations statement.
You can find out many standard factory reports that use this technique of double pass to construct, enrich a data set.
Hope this work-around helps, and good luck. Regards
I was also trying to create an expression (CASE WHEN/IF) in the query activity(Just before the Page activity) while fetching this field, However, on doing so, the column is completely coming blank in the report.Unsure, why!
Can you name some standard factory reports where such case is handled, as you mentioned in your earlier reply, so that I can refer it?