<div dir="ltr"><div>So I have a NameSet that is defined at the query scope, but I have CalculatedMeasures that are defined in the schema that I'd like to refer to that NamedSet. The reason the NamedSet is defined outside of the schema is because the user can alter it. If I define both NamedSet and Calculated Measures at query scope then my query works fine.</div><div><br></div><div>So I tried to use StrToSet to work around this doing something like:</div><div><br></div><div>StrToSet("[MyNamedSet]", [Date].[YearQuarterMonth]) </div><div><br></div><div>But that doesn't work as I get an error:</div><div><br></div><div>Member [MyNamedSet] cannot be found.</div><div><br></div><div>After digging through the code in StrToSet() it assumes that the string contains a member/tuple of the hierarchies provided in the 2nd+ arguments. This would work fine in Microsoft SAAS as it treats the StrToSet as a dynamic expression that results in a Set. StrToSet in Mondrian is much more limited.</div><div><br></div><div>So I decided I'd try and write a UDF that let's me provide the name of a NamedSet and it returns the NamedSet to work around Mondrian trying to resolve the NamedSet at schema load time.</div><div><br></div><div>Set asNamedSet("[MyNamedSet]")</div><div><br></div><div>However, Mondrian doesn't offer any way for a UDF, or FunDef for that matter, to lookup NamedSets through the Evaulator. After using some reflection to break into Query.scopedNamedSets I could get the NamedSet by name. After that my query failed because some eager compliation logic. For example doing this:</div><div><br></div><div>asNamedSet("[MyNamedSet]").Item(0).Hierarchy</div><div><br></div><div>Blows up because when the schema is loaded it tries to check the arity of the SetType and the parameters it's passed. If that was done closer to query execution it'd be fine.</div><div><br></div><div>So my question is how can I do this in Mondrian? I'd like to delay expressions to be more late which I think is possible in most cases. It just seems like I'm blocked at every point.</div><div><br></div><div>I'm using Mondrian 4.3.</div><div><br></div><div>Charlie</div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Charlie Hubbard | Chief Technology Officer<div><div><span style="font-weight:bold;background-color:rgb(255,255,255)"><font color="#0b5394">F</font><font color="#f6b26b">u</font><font color="#0b5394">se</font></span><font color="#0b5394" style="font-weight:bold"> Analytics</font><font color="#0b5394"> </font><font color="#000000">| </font><font color="#000000">404.234.8094</font></div></div></div></div>
</div>