Home > Archive > MS SQL Server OLAP > August 2005 > Simple Optimization advice needed









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Simple Optimization advice needed
martinbx

2005-08-30, 9:26 am

Hi!
I would be thnkful for advice on how to optimize following code:
iif
(
Descendants(A,10, LEAVES).Count < 1,
0,
iif
(
Descendants(A,10, LEAVES).Item(0).Property("X")=CStr("123"),
0,
iif
(
Descendants(A,10,
LEAVES).Item(0).Property("Y")=CStr("768"),
1,
0
)
)
)

I do Descendants(A,10, LEAVES) three times. Is it possible to do it only
once ?
Joel Leong

2005-08-30, 1:23 pm

can you use AND operator

iif(Descendants(...).Count <1 AND ..... AND ...., 0, 1) ??

"martinbx" < martinbx@discussions
.microsoft.com> wrote in message
news:38C40AFB-B07C-4F15-A773- 946210987B2D@microso
ft.com...
> Hi!
> I would be thnkful for advice on how to optimize following code:
> iif
> (
> Descendants(A,10, LEAVES).Count < 1,
> 0,
> iif
> (
> Descendants(A,10, LEAVES).Item(0).Property("X")=CStr("123"),
> 0,
> iif
> (
> Descendants(A,10,
> LEAVES).Item(0).Property("Y")=CStr("768"),
> 1,
> 0
> )
> )
> )
>
> I do Descendants(A,10, LEAVES) three times. Is it possible to do it only
> once ?



martinbx

2005-08-30, 1:23 pm

It will not help, because I still have to call Descendants(A,10, LEAVES) 3
times in a row to get EXACTLY the same information

"Joel Leong" wrote:

> can you use AND operator
>
> iif(Descendants(...).Count <1 AND ..... AND ...., 0, 1) ??
>
> "martinbx" < martinbx@discussions
.microsoft.com> wrote in message
> news:38C40AFB-B07C-4F15-A773- 946210987B2D@microso
ft.com...
>
>
>

Deepak Puri

2005-08-31, 3:24 am

You could try a Set Alias, as in this Foodmart query:
[color=darkred]
With Member [Measures].[DescendTest] as
'iif({Descendants([Employees].CurrentMember, 4, LEAVES) as SetD}.Count <
1,
0,
iif(SetD.Item(0).Properties("Marital Status") = "S",
0,
iif(SetD.Item(0).Properties("Gender") = "F",
1, 0)))'
select {[Measures].[StoreCount], [Measures].[DescendTest]} on columns,
{[Employees].[All Employees].[Sheri Nowmer].[Donna Arnold]} on rows
from HR[color=darkred]


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.droptable.com ***
martinbx

2005-08-31, 1:24 pm

Thanks.

"Deepak Puri" wrote:

> You could try a Set Alias, as in this Foodmart query:
>
> With Member [Measures].[DescendTest] as
> 'iif({Descendants([Employees].CurrentMember, 4, LEAVES) as SetD}.Count <
> 1,
> 0,
> iif(SetD.Item(0).Properties("Marital Status") = "S",
> 0,
> iif(SetD.Item(0).Properties("Gender") = "F",
> 1, 0)))'
> select {[Measures].[StoreCount], [Measures].[DescendTest]} on columns,
> {[Employees].[All Employees].[Sheri Nowmer].[Donna Arnold]} on rows
> from HR
>
>
> - Deepak
>
> Deepak Puri
> Microsoft MVP - SQL Server
>
> *** Sent via Developersdex http://www.droptable.com ***
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com