Sorry. Forget point 1) from my last post. It work in report. My mistake. Again sorry !!!
Report
Collapse
X
-
Originally posted by MihailMihail:
This is not a very clever question, Vish, but I must ask: Is your control enough large to display entire value ?
I think you may have missed this question from post #13, which is a shame as I believe it may be an important one. Try enlarging it greatly just to test the idea.Comment
-
Mihail, thanks for the tip. I put this condition in the query and it worked finally!. Neopa, I did not want to enlarge the size since some percentages appeared too wierd to display. Thought better not to display at all unless it is within a range of +100% and -100%. Realized that "format" can be a very tricky function in a report. Mihail, I changed the condition of the "length" to include also the decimal point , as you indicated. I used the following condition in the query.=
Code:IIf([z]=0,0,IIf([x]=0,0,IIf([z]<0 And [x]>0,0,IIf([z]>0 And [x]<0,0,IIf(Len(FormatPercent([z]/[x],2))>9,0,Round([x]/[z],2))))))
Comment
-
First, please check out [CODE] Tags Must be Used.
Originally posted by VishVish:
NeoPa, I did not want to enlarge the size since some percentages appeared too wierd to display.Comment
-
Neopa,When x and z were in decimals, the percentages displayed after enlargement of the control Y in the report design, were too big to even read like for example -698679.41%.Comment
-
... and therein lies your problem it would seem. I hope you're now glad you did the test ;-)
How to resolve it is the next step. Such values indicate to me that either :- Your data is not sensible.
- Your basic design is flawed as it cannot handle the data it needs to display.
Essentially, if X is so large in relation to Z then either that data is faulty, or else it's fine, in which case you haven't designed to allow for what you've got.Comment
-
As usually, NeoPa take my face :)
There are a lot of questions like WHY ?
1) Why you wish to handle that using Len() function ?
This can't be a good approache because:
Say you establish the number of digits to 3.
So you can show values between -99 to 999 (% of course). If you need to display 0.01 you can't ?!?!?
More, if you wish to display -0.01 you can't.
2) Why, if your logic is in numeric values ("the percentage can't be higher than... 500% and can't be less than... -400%") your option is to manage the number of digits to display and not the values itself:
Code:IIF(([X/[Z] > 4) And ([X]/[Z]<5), [X]/[Z],"Out of range, my dear")
Comment
Comment