PDA

View Full Version : Filter boolean values from properties



janheise
10-07-2003, 04:04 AM
i have the following problem with one of my mdx-queries:
i define a member like:
member [Measures].[Ueberweisung] as '[Store].CurrentMember.Properties("Ueberweisung")'
with the following snippet from my schema:
<Property name="Ueberweisung" column="ueberweisung" type="Boolean"/>
i want to filter in the mdx for true/false values like e.g.:
NON EMPTY { Filter ( Descendants( [Store].[xxx].[yyy], [Store].[Name] ), ([Measures].[Ueberweisung] = 'true') ) } on rows
how do i have to specify the expression? i tried:
([Measures].[Ueberweisung] = 'true')
([Measures].[Ueberweisung] = "true")
([Measures].[Ueberweisung] = true)
([Measures].[Ueberweisung]) -> would expect it to evaluate to true/false because the property is a boolean
but i always get an exception like:
Caused by: java.lang.ClassCastException
at mondrian.olap.fun.FunUtil.getStringArg(FunUtil.java:57)
at mondrian.olap.fun.BuiltinFunTable$127.evaluate(BuiltinFunTable.java:4665)
or
FunUtil.getBooleanArg
i browsed through my mdx-books but there is _no_ info on booleans through my whole literature!
jan

pandominox
09-23-2015, 09:16 AM
Hello,
Try to cast the property to String type in clause WITH MEMBER and then use it in FILTER (in logical expression in comparison with string 'true'/'false'), e.g.:

WITH MEMBER [Measures].[Ueberweisung] AS CAST([Store].CurrentMember.Properties("Ueberweisung") AS String)
SELECT ....
NON EMPTY { Filter ( Descendants( [Store].[xxx].[yyy], [Store].[Name] ), ([Measures].[Ueberweisung] = 'true') ) } ON ROWS
...

Best regards, pandominox.

mcampbell
10-01-2015, 03:42 PM
It should also be possible to use the boolean directly without casting. Something like:

Filter ( Descendants( [Store].[xxx].[yyy], [Store].[Name] ), [Store].CurrentMember.Properties("Ueberweisung") = true )