Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppressing Subreports Post Reply Post New Topic
Page  of 2 Next >>
Author Message
khyulitz10
Newbie
Newbie


Joined: 11 Aug 2011
Location: United Kingdom
Online Status: Offline
Posts: 24
Quote khyulitz10 Replybullet Topic: Suppressing Subreports
    Posted: 23 Apr 2012 at 5:26am
Hi,
 
I have 5 sub-reports placed in 5 different groups. Subreports are the invoices due within weeks. ( 1 week, 2 weeks, 4 weeks, 6 weeks, 8 weeks)
 
I've done this successfully but the only problem is that subreports seem to appear 10x which make 50+ pages and I don't know how to suppress it. Tried the "Previous" formula but it just lessen the page..
 
Any help please? Thank you.
 
ESC :)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Apr 2012 at 8:42am
one would think that there are due dates for each invoice. 
 
using this I would think that you would utilize the conditional suppression for each section with something like
 
{table.dueDate} < dateadd("d", -7, currentDate)
or
{table.dueDate} > dateAdd("d", 0, currentDate)
 
I may have the numbers wrong, but what I trying to do is the check the invoice due date as compared to the date. If the due date is in the range you get a false result which will display the subreport, if you get a true, the section will be hidden.
 
Obviously you could use a different algorithm as you know when/how your report will be run, but hopefully it is a path to the solution.
IP IP Logged
khyulitz10
Newbie
Newbie


Joined: 11 Aug 2011
Location: United Kingdom
Online Status: Offline
Posts: 24
Quote khyulitz10 Replybullet Posted: 03 May 2012 at 5:30am
Thanks Lockwelle. Finally did this.
 
One more question please. I wanted to convert the USD to GBP. How do I do this please. I'm trying to figure it out but I can't..
 
Please help..
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 03 May 2012 at 5:48am

you just need a formula like

{table.money_field} * 0.6175

IP IP Logged
khyulitz10
Newbie
Newbie


Joined: 11 Aug 2011
Location: United Kingdom
Online Status: Offline
Posts: 24
Quote khyulitz10 Replybullet Posted: 09 May 2012 at 12:58am
Thanks Kostya1122.
 
But how do I convert these if I have several currencies that are in a group?
 
There's a Calc_Currency group which inlcudes EUR, GBP and USD.
 
I want to sum up each of these base on the currency.
 
What formula should I use to convert them?
 
I used the running total and it's working fine but it's in USD though.
 
Help please.
 
Thanks in Advance.
 
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 09 May 2012 at 4:00am
you would need to know what the currency is, then in the formula you would need to convert each different currency correctly, lastly, you would want to 'save' the total to a shared variable.
 
shared variables are like running totals, just you need to do all the work. They typically come in groups of 3 (reset, increment, display)
reset is typically in a group header:
shared numbervar x:= 0;
"" //will hide the 0
 
increment is typically in the detail section:
shared numbervar x;
 
if (something) then
 x := x + {table.field} * conversion; (in your case
 
"" //again hides the running total
 
display typically in the group footer
shared numbervar x;
x
 
HTH
IP IP Logged
khyulitz10
Newbie
Newbie


Joined: 11 Aug 2011
Location: United Kingdom
Online Status: Offline
Posts: 24
Quote khyulitz10 Replybullet Posted: 09 May 2012 at 4:29am
Thanks Lockwelle.
 
Before I go down to the shared variable, I want to get the formula for the conversion correctly. Here is what I did:
 
Assuming these are the rates for each currency:
 
if ToText({#Grp1Subtotal1}) = "EUR" then {ARDTLS.Calc_AgeInvAmt1}* 1.316200
    else if ToText({#Grp1Subtotal1}) = "GBP" then {ARDTLS.Calc_AgeInvAmt1} * 1.601450
        else if ToText({#Grp1Subtotal1}) = "USD" then {ARDTLS.Calc_AgeInvAmt1} * 1.000000
 
------------
 
All I get is 0 from this formula. Don't know where I went wrong ??
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 09 May 2012 at 4:52am
I am assuming that the subtotal is a number (hence the toText)...why would a number have the currency in it?
 
If the {#Grp1Subtotal1} already has the currency desiginator in it, you can change the code to something like:
 
if Instr({#Grp1Subtotal1}, "EUR") > 0 then
 
otherwise, formula looks fine. 
IP IP Logged
khyulitz10
Newbie
Newbie


Joined: 11 Aug 2011
Location: United Kingdom
Online Status: Offline
Posts: 24
Quote khyulitz10 Replybullet Posted: 09 May 2012 at 5:16am

The subtotal is in dollars and it does not have the currency in it. It is placed in the Group footer of "Cal_currency".

I just put the "ToText" into it because I'm getting error as subtotal is a number.
 
Yes, it looks fine but it's not giving me the correct answer though :(
 
is there any other alternative formula that I can try?
 
 
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 09 May 2012 at 6:09am
try

if ToText({#Grp1Subtotal1}) like "*EUR*" then {ARDTLS.Calc_AgeInvAmt1}* 1.316200
    else if ToText({#Grp1Subtotal1}) like "*GBP*" then {ARDTLS.Calc_AgeInvAmt1} * 1.601450
        else if ToText({#Grp1Subtotal1}) like "*USD*" then {ARDTLS.Calc_AgeInvAmt1} * 1.000000

but why you're using  totext if a field contains letters is should be a string already
do you have a field like currency type to use it instead of {#Grp1Subtotal1}?

IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.023 seconds.