Friday, February 10, 2012

can't get multiple values using reportItems

On a report I have I have a hidden table which I am trying to get values from for a total. On a seperate table, I have an if statement that checks if a product # matches one on this table. This works fine if there is only one record in the hidden table. If there are more than one records, the ReportItems call only see's the last textbox (the last record) of the hidden table. Here's the total expression I use

=IIf( sum(Fields!PickupDeliveryDetails_New.Value)+ sum(Fields!PickupDeliveryDetails_Extra.Value) <= 0, 0 ,((sum(Fields!PickupDeliveryDetails_New.Value) + sum(Fields!PickupDeliveryDetails_Extra.Value)) /

(ReportItems("textbox36").Value

)

)

* (Fields!Actuals_TotalPTypeCharge.Value)

+ (IIf(ReportItems("table6"."TableColumn1").Value = Fields!Product_BPCSNumber.Value, ReportItems("textbox50").Value ,

IIf(First(ReportItems("table6"."TableColumn1").Value) = Fields!Product_BPCSNumber.Value, First(ReportItems("textbox50").Value) , 0 ) ) )

)

Any help on this would be greatly appreciated.

Morgan

That piece of code was not working. Heres the working code.

=IIf( sum(Fields!PickupDeliveryDetails_New.Value)+ sum(Fields!PickupDeliveryDetails_Extra.Value) <= 0, 0 ,((sum(Fields!PickupDeliveryDetails_New.Value) + sum(Fields!PickupDeliveryDetails_Extra.Value)) /

(ReportItems("textbox36").Value

)

)

* (Fields!Actuals_TotalPTypeCharge.Value)

+ (IIf(ReportItems("textbox27").Value = Fields!Product_BPCSNumber.Value, ReportItems("textbox50").Value , 0 ) ))

|||First of all, never use neon green on the post its VERY HARD to read. Is it possible to do a group by Product# in the hidden table and then run an aggregate sum on the values you want added. That way when you reference the textbox in the hidden table from the other table it would be the sum of all values for that same product #|||

That wouldn't work because I need seperate values for each product type total. There is a group by product # but there are multiple product #s.

I have solved my problem by getting the results from the hidden table in the second table (i got the values in the dataset by using left outer joins).

I would still like to know if there is a way to do what I was trying to do if it ever came up again and it couldn't be solved in the query.

No comments:

Post a Comment