The Parameters section of the documentation says it can be done.... that composite operators can take a comma delimited series of attributes as a parameter, but if I go into the composite operator syntax, I don't see a way to do it.
Is it actually possible? How do I need to do it?
Or do I have to punt and rewrite my existing composite operator in C++ just to get this feature?
The answer below is not what he is referring to. With primitive operators, you can pass a comma-separated list of attribute names (e.g Join operators equalityLHS & equalityRHS parameters).
Within the documentation (Reference > Streams Processing Language reference > Operators > Operator invocations > Param Clause), it states that you can do this with Custom operators:
...
a comma-separated list of stream attribute names
a comma-separated list of expressions
a function name
an operator name
a type
... composite operators can also accept parameters of the forms 3, 4, and 5 in the list.
Is there an example of how to do this? passing them the way you would to the Join operator does not seem to work. Is there a special syntax to use when defining the parameter of the composite?
Answer by hnasgaard (1441) | Mar 05, 2014 at 08:28 AM
I think the answer is, the documentation is incorrect; it can't be done. If you look at the expression modes in Reference -> Streams Processing Language reference -> Operators -> Operator definitions -> Operator Parameters -> Operator Parameter Modes, the expressionModes allowable for a composite parameter are described. One mode is attribute, which allows you to specify a single attribute. There is no syntax for a list<attribute>. If your attribute types are all the same you can sort of do what you want by creating a list, [a,b,c] and using an expressionMode of expression, or expression<list<t>>, where T is the type. How did you want to use the list of attributes within the composite?
Thanks - not what I was hoping to hear, but what I figured was the answer.
What I'm trying to do is have a composite where it enhances the tuple based on one attribute (i.e. a lookup based on it), and stores the result in a second. What would be nice is to have something like Sort's fields/order pairing, where there's two lists, so I'd have the parameter with the attributes to look up as a list, and then the parameter with the attributes to store the result as a list.
The expression list would work for the first (what to lookup), but I don't think I can do tuple.$parm[1] = "value" to store the result.
Answer by Stan Bradbury (1290) | Mar 04, 2014 at 09:46 AM
Take a look at the example in this post.
https://www.ibmdw.net/answers/questions/5043/syntax-for-classlibrary-with-multiple-elements//7992