Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Problem with Formula in report Post Reply Post New Topic
Author Message
CeeDee
Newbie
Newbie


Joined: 01 Jun 2010
Online Status: Offline
Posts: 4
Quote CeeDee Replybullet Topic: Problem with Formula in report
     Posted: 01 Jun 2010 at 6:12am
Hi First post so please be gentle. Smile

I'm using Crystal Reports with a commercial program I use at my work. I have managed to tweak a report to generate the information I need but I'm failing on one thing. I've tried to create a formula field that will show the text
"Gables to floor" when true.

Here is the line I typed
if {PRODUCT_PARAMETERS.PARAMETER_CODE}="_GablesToFloor"
and {PARAMETER_VALUES.PARAMETER_VALUE}=3 then "Gables to floor"

It does work but unfortunately there is like 1000+ pages created. It appears that it is going through the whole list of paramaters and showing the results and when it hits the one stated above shows my text.
 So for one item I have about 20+ results instead of the one result showing no comment or the one ive stated above.

I'm starting to think it has something to do with the position of the formula in the report as I have come across something similar in the past and had to create a sub-report.

Any help is greatly appreciated. Tongue

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Jun 2010 at 6:18am
Are you trying to change the value that appears in the pick list of values of a dynamic param or are you trying to change the vlaue as it appears in the report canvas?
IP IP Logged
CeeDee
Newbie
Newbie


Joined: 01 Jun 2010
Online Status: Offline
Posts: 4
Quote CeeDee Replybullet Posted: 01 Jun 2010 at 6:26am
Not trying to change any value just report a text message that when the result of both parameters are true. Both sets of parameters are populated so by that I guess that means they are dynamic.

Sorry to appear noobish but I am fairly new to Crystal Reports and not totally clued up on all the jargon. Embarrassed


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Jun 2010 at 6:41am
No Prob.
I think You may be placing your formula in the Select Expert.
Remove it from the select expert.
 
For a display string formula (rather than a data filter)
go into the Field Explorer
Right Click on Formula Fields
Select New
Name your formula whatever you want
Place your formula (which looked fine) here
if {PRODUCT_PARAMETERS.PARAMETER_CODE}="_GablesToFloor"
and {PARAMETER_VALUES.PARAMETER_VALUE}=3 then "Gables to floor"
Save and Close
Place this formula field on your report canvas detail section.
Now if that data row has True for both parts you should get your text otehrwise you should see an empty string (blank).
Does that fix it?
 
 
IP IP Logged
CeeDee
Newbie
Newbie


Joined: 01 Jun 2010
Online Status: Offline
Posts: 4
Quote CeeDee Replybullet Posted: 01 Jun 2010 at 7:04am
Thanks for the assist DBlank. Had to leave the office for today so I'll do what you suggested above tomorrow and I'll let you know how I get on.Big%20smile


IP IP Logged
CeeDee
Newbie
Newbie


Joined: 01 Jun 2010
Online Status: Offline
Posts: 4
Quote CeeDee Replybullet Posted: 02 Jun 2010 at 6:53am
Ok tried this again and what you replied is what I had done originally.

The formula was typed in a Formula Field named "GablesToFloor".

I tried something a little different but basically did the same thing as above. What I did suss out though was that it appears the formula is running through the full 248 entries that are under the report field {PRODUCT_PARAMETERS.PARAMETER_CODE}.

When I previewed the report it had 83 pages of which 82 had 3x results per page and 1 had 2x results = (83x3)+2 = 248 results which is the same number of parameters populating
{PRODUCT_PARAMETERS.PARAMETER_CODE}.

So I'm now thinking how do I get it to only check the 2nd entry which is my _GablesToFloor parameter that I'm trying to create the string result from?




Edited by CeeDee - 02 Jun 2010 at 7:28am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jun 2010 at 9:08am
The formula should have no impact on the number of rows returned / pages of the report.
I am strting to think that maybe youa re trying to use this formula in lieu of a table join.
Rather than talking formulas please explain what you are trying to do in and what the report is doing that is not 'correct' as wella s how your joins are set up.
Thanks.
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 03 Jun 2010 at 1:33am
I had a similar problem, where I was writing a formula, and inserting it into the report (details section)and it was giving me multiple lines where I only needed / expected the one line.
 
My workaround was:

Hide the details Section, and insert a summary on the formula field at group level.
 
this solved my problem.
Regards,

Michael Jones
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum