We help IT Professionals succeed at work.

RDLC

aspnetdev
aspnetdev asked
on
Medium Priority
1,484 Views
Last Modified: 2012-05-06
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,
Comment
Watch Question

Commented:
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.

Author

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.

Commented:
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

Author

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

Author

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.

Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.