• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1426
  • Last Modified:

RDLC

Hi ,
I have added following Expression in one of cell of my rdlc but i am getting an error.
=iif(  (ReportItems!textbox43.Value <> "N/A") AND (ReportItems!textbox46.Value <> "N/A"),(((1+ReportItems!textbox43.Value)/100)/((1+ReportItems!textbox46.Value)/100)-1),"0.00%")

If i remove the formula from the expression above,it works good,can any one tell me how to make above expression work.
Basically the logic is If ReportItems!textbox43.Value & ReportItems!textbox46.Value is not equal to N/A then (((1+ReportItems!textbox43.Value)/100)/((1+ReportItems!textbox46.Value)/100)-1) else 0.00%
Can any one help ASAP.
Thanks,
0
aspnetdev
Asked:
aspnetdev
  • 3
  • 3
1 Solution
 
shorakCommented:
Hi.. could you tell us what the error message is and which part of the expression works? Looking at the formulae as it stands, you have the correct number of brackets and the structure of the IIF statement is correct.
0
 
aspnetdevAuthor Commented:
i get this #error and if i replace following parameter in IIF condition
(((1+ReportItems!textbox43.Value)/100)/((1+ReportItems!textbox46.Value)/100)-1)  
with something like "This is a test",it works.
0
 
shorakCommented:
Try replacing

(((1+ReportItems!textbox43.Value)/100)/((1+ReportItems!textbox46.Value)/100)-1)  
with

(((cint(ReportItems!textbox43.Value)+1)/100)/((cint(ReportItems!textbox46.Value)+1)/100)-1)

it could be that the values in texbox43 and 46 might not be numbers even though they look like numbers and hence it cant do the calculations.

Rob
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
aspnetdevAuthor Commented:
You are correct shorak,actually the equation is becoming N/A/100 and hence no calculation can be done.Anyways i tried
=iif(  (ReportItems!textbox43.Value <> "N/A") AND (ReportItems!textbox46.Value <> "N/A"),((cint(1+ReportItems!textbox43.Value)/100)/((1+cint(ReportItems!textbox46.Value))/100)-1),"0.00%")

i still get #error.Can you help me more.
Thanks
0
 
aspnetdevAuthor Commented:
and i tried this too....
 (((cint(ReportItems!te­xtbox43.Va­lue)+1)/10­0)/((cint(­ReportItem­s!textbox4­6.Value)+1­)/100)-1) 

i still get #Error.

0
 
shorakCommented:
Do the contents of textbox43 and texbox46 always say 'N/A' when its not a number or can they say something else too?

We also need to make sure that textbox43 and texbox46 are both numeric.
Are textbox43 and texbox46 are part of a table row? If so, then add 2 extra columns at the end and put the following expressions in each one:
1st column
=IsNumeric(ReportItems!te­xtbox43.Va­lue)

2nd column
=IsNumeric(ReportItems!te­xtbox46.Va­lue)

These two columns will tell us if the values in the two texboxes are numbers or not.. if they are then they both will say "True" (apart from when the two fields say 'N/A').
If you dont have a table then just create two textboxes and put the same expressions in each box. Both should say true. If so, then delete the extra columns/textboxes you just created. If you get 'False' when  textbox43 and texbox46 dont say 'N/A', then there is an issue with the data type.

Also it might be worth testing out each part of your rexpression. First, try the following expressions and see if you get an error..

1)
=IIF (ReportItems!textbox43.Value <> "N/A" AND ReportItems!textbox46.Value <> "N/A","OK","Not OK")

2)
= IIF (ReportItems!textbox43.Value <> "N/A" AND ReportItems!textbox46.Value <> "N/A",(cint(ReportItems!textbox43.Value)+1)/100,"0.00%")

3)
= IIF (ReportItems!textbox43.Value <> "N/A" AND ReportItems!textbox46.Value <> "N/A",
((cint(­ReportItem­s!textbox4­6.Value)+1­)/100)-1 ,"0.00%")

4)

= IIF (ReportItems!textbox43.Value <> "N/A" AND ReportItems!textbox46.Value <> "N/A",
 ((cint(ReportItems!textbox43.Value)+1)/100)/(((cint(­ReportItem­s!textbox4­6.Value)+1­)/100)-1) ,"0.00%")


The code snipet below should hopefully work for you.

Rob


= IIF(ReportItems!textbox43.Value <> "N/A" AND ReportItems!textbox46.Value <> "N/A",
((cint(ReportItems!textbox43.Value)+1)/100)/(((cint(ReportItems!textbox46.Value)+1)/100)-1) ,"0.00%")

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now