Aggregrates in an Expression
So i have a crystal expression If Distinctcount(WOnumber),(invoicenumber) >1 then "Sell below" Else suppliercompany. This is my ssrs expression = iif CountDistinct(Fields!WOLINENUMBER.Value),Fields!INVOICENUMBER.Value)>1, "See Below", Fields!SUPPLIERCOMPANY.Value) I get an error right by "iif" as wrong number of arguments am i missing anything ?  Please help FM
July 13th, 2011 12:30pm

Hi FM, I'm not sure what are trying to do, but just a hunch, try this:- = IIf ( Sum ( CInt ( CountDistinct (Fields!WOLINENUMBER.Value ) ) + Fields!INVOICENUMBER.Value ) > 1, "See Below", Fields!SUPPLIERCOMPANY.Value ) Please let us know your feedback. Thanks KumarKG, MCTS
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 12:36pm

Kumar i get #Error when i run that expressionFM
July 13th, 2011 12:49pm

Farhan1, the exprssion you have used is wrong. What are you trying to do?
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 12:55pm

Hi FM, What are trying to do? Can you please describe briefly? What is your expected opt? You can try this:- = IIf ( Fields!INVOICENUMBER.Value > 1, "See Below", Fields!SUPPLIERCOMPANY.Value ) But I'm sure where you want to included "CountDistinct" too with the above expression. Thanks Kumar KG, MCTS
July 13th, 2011 1:08pm

Basically want i want if there is more than one record for wonumber & invoice number then i should see "See Below" If there`s one record then i only want to see the value for fields!supliercompany.value.FM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 1:52pm

try this:- = IIf ( ( CountDistinct (Fields!WOLINENUMBER.Value ) > 1 ) AND ( Fields!INVOICENUMBER.Value > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) Thanks KumarKG, MCTS
July 13th, 2011 1:57pm

I tried that and i still get the same error #ERROR.FM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 2:04pm

= IIf ( ( CInt ( CountDistinct (Fields!WOLINENUMBER.Value ) ) > 1 ) AND ( CInt ( Fields!INVOICENUMBER.Value > 1 ) ), "See Below", Fields!SUPPLIERCOMPANY.Value ) KG, MCTS
July 13th, 2011 2:06pm

Still the same error Kumar.FM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 2:12pm

try both separately, = IIf ( ( CountDistinct ( CInt ( Fields!WOLINENUMBER.Value ) ) > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) = IIf ( ( CInt ( Fields!INVOICENUMBER.Value ) > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) Thanks Kumar KG, MCTS
July 13th, 2011 2:22pm

Ok it works =IIf ( ( CountDistinct ( CInt ( Fields!WOLINENUMBER.Value ) ) > 1 ) and CountDistinct ( CInt ( Fields!WOLINENUMBER.Value ) )> 1, "See Below", Fields!SUPPLIERCOMPANY.Value ) But when i am tryin to verify i should see "See below" if there`s more than one record.. yet i suppliercompany anmeFM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 2:38pm

Hi again, Why you are trying same condition twice in your IIF statment, Isn't below one condition is enough based on your request. = IIf ( ( CountDistinct ( CInt ( Fields!WOLINENUMBER.Value ) ) > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) OR = IIf ( ( CountDistinct ( Fields!WOLINENUMBER.Value ) > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) Please do let us know your feedback. Thanks KumarKG, MCTS
July 13th, 2011 2:47pm

I think you got it all wrong from the crystal reports. The expression for crystal report meant was that for evry invoice number ,count of Wolinenumber >1 then "sell below"or "supplier company" that means invoice number here is a scope i guess rather than two exp one for WOLINE number and one for invoice number. So since the invoice number is a field than a dataset in your report you cant keep the field as scope in your exp for SUM or Count so what you can do is grping based on invoicen umber and in that grp if you keep the expression = IIf ( ( CountDistinct ( CInt ( Fields!WOLINENUMBER.Value ) ) > 1 ), "See Below", Fields!SUPPLIERCOMPANY.Value ) That might work, Let me know if i am thinking right . I will be glad if i am wrong :)
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 3:21pm

If what i speculated above is wrong then you can try this ! =IIF((CountDistinct(Fields!WOLINENUMBER.Value ))>1,"sell below","suppliercompany") And IIF((CountDistinct(Fields!INVOICENUMBER.Value ))>1,"sell below","suppliercompany")
July 13th, 2011 3:44pm

I actually got it working i did some more research and it works the way i wanted to =iif(Fields!WOLINENUMBER.Value>1, "See Below", Fields!SUPPLIERCOMPANY.Value) FM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 3:49pm

Glad that it worked and the o/p is what you wanted but the exp which worked for you is no where related to what you have asked in the beginning :)
July 13th, 2011 4:06pm

I know the im thinking the expression logic in crystal is bit diff than what we create in SSRS? or am i wrong?FM
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 4:09pm

Hi FM, This is totally different than what you have asked in your thread. Anyways if that helped you than you need to learn the things little more either it is Crystal Reports or its SSRS. Thanks KumarKG, MCTS
July 13th, 2011 4:13pm

Usually the logic is similar most of the cases but in this case the crystal exp clearly states the count of WOLINENUMBER > 1 then sell below but what you did is way different, you are checking if the value of the field WOLINENUMBER > 1 and then displaying sell now .AREnt you supposed to do count distinct too in your exp?
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 4:15pm

Yeah what i wanted to do is if there is more than one record perline item... so it still doesnt full timme my requirementFM
July 13th, 2011 4:49pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics