Wednesday, March 7, 2012

Please put me out of my scoping misery

Hi

I have a table with 2 groupings

OrderType

Month

so I might have

OrderType 1 1000

OrderType 2 2000

Month=Jan 3000

OrderType 1 4000

OrderType 2 5000

Month=Feb 9000

OrderType footers contain an experssion =sum(Fields!.ItemQty.value , "OrderType")

What is the correct scope to put have 'grand totals' in the Month grouping and what should i have in each of the group footers

(I've tried replacing "OrderType" with "Month" and putting the expression in both group footers but nothing works)

I've read various posts and articles on scope but I'm either totally misunderstanding the principle or getting my syntax wrong as I either get errors say the scopes wrong or blank values.

I'm not using group headers, only

Detail Line

OrderType group footer

Month group footer

Thanks

Steven

Hi Steven,

You can directly use sum(Fields!.ItemQty.value) without giving any scope in the group footer and this will by default consider that scope itself.

But even if you want to write scope, pls use same group name( case sensetive) and you can use outer groups name in the inner group for scope but vice versa will give an error of "out of scope"

Hope this helps!

Priyank

|||

Priyank

thanks for this, but that's where i started from and all I was getting at the time was #Error

in more detail i have

Detail line: =iif(Fields!ORDERTYPE.Value="103) or (Fields!ORDERTYPE.value="160").Fields!ITEMQTY.Value,0)

[3] OrderType GF: =sum(iif(Fields!ORDERTYPE.Value="103) or (Fields!ORDERTYPE.value="160").Fields!ITEMQTY.Value,0) , "OrderType" )

[2] Month GF : =sum(iif(Fields!ORDERTYPE.Value="103) or (Fields!ORDERTYPE.value="160").Fields!ITEMQTY.Value,0) , "Month")

I know the name and case of the scopes is correct as I copied and pasted them from the Group Properties section.

One point to note which may or may not be important, is that although OrderType is above the Month Group , they're shown as [3] and [2] as above. Have I gotten the wrong way around.

Thanks

Steven

|||

Steven,

Please try out these and let me know are they solving the issue.

Detail line: =iif(Fields!ORDERTYPE.Value="103" or Fields!ORDERTYPE.value="160",Fields!ITEMQTY.Value,0)

[3] OrderType GF: =sum(iif(Fields!ORDERTYPE.Value="103" or Fields!ORDERTYPE.value="160",Fields!ITEMQTY.Value,0))

[2] Month GF : =sum(iif(Fields!ORDERTYPE.Value="103" or Fields!ORDERTYPE.value="160" ,Fields!ITEMQTY.Value,0))

Priyank

|||

Priyank

thanks. I did this and the Detail and Ordertype give the correct values, but the Month GF just gives #Error

This is where I started from yesterday and ended up thinking about the scope.

Is there anything else I can try.

Regards

Steven

|||

Hello,

Can you post the error you are getting? From within BIDS, look in your output window (Ctrl+Alt+O).

Jarret

|||

Jarret

I've now resolved this by amending the SQL query to do some pre-calculation. All of my SUM calcs now work that I'm not having to use the iif statements.

I guess I've gotten lazy with Crystal Reports where you can pretty much do everything through the tools therein having selected all data from everywhere and manipluate it through the wizards etc.

Thanks for responding though.

Steven

No comments:

Post a Comment