<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&#39;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(&quot;[MyNamedSet]&quot;, [Date].[YearQuarterMonth]) </div><div><br></div><div>But that doesn&#39;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&#39;d try and write a UDF that let&#39;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(&quot;[MyNamedSet]&quot;)</div><div><br></div><div>However, Mondrian doesn&#39;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(&quot;[MyNamedSet]&quot;).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&#39;s passed.  If that was done closer to query execution it&#39;d be fine.</div><div><br></div><div>So my question is how can I do this in Mondrian?  I&#39;d like to delay expressions to be more late which I think is possible in most cases.  It just seems like I&#39;m blocked at every point.</div><div><br></div><div>I&#39;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>