Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: variables don't seem to be working Post Reply Post New Topic
<< Prev Page  of 3
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 5:10am
Ahhh-I just noticed you altered the detail one to remove the space and comma
if you do not want a space between the Y or N for multiple rows then fix two things
details needs the comma after the Y or N
Fica := Fica + (If {ETax.tcode} In ["MED", "SS"] Then "Y," else "N,");
footer needs to only subtract 1 (removes the trailing ",")
Shared StringVar Fica := if Fica=0 then "Whatever you want here" else Left(Fica,len(Fica)-1);
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 5:13am
You were seeing no results or getting the error for groups with less than 3 detial rows.
Without the "," on it the length of Fica was only the number of rows (1 character per row).
The display was always subtracting 2 from the length.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 5:16am
Even though you should alwasy have at least 1 fica record I would still leave the if-then potion in the display footer formula to acount for the possibility of an error. You can display "Missing" or "Error" instead of having the report 'crash' in case the DB gets screwy.
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 31 Jul 2013 at 5:46am
yeah that is a good point. i have it set up and fine tuning it to show correctly but so far this is what i'm getting.

every employee has 7 tax codes for various taxes according to payroll. so on the footer where all the records are shown in 1 line for this it will show like

NNNYNYN

becuase it's evaluating every tcode and answering accordingly but i only need a single Y if the employee as SS or MED tax code or a single N if they do not.

If i do something like this Shared StringVar Fica := Left(Fica,len(Fica)-6); in the footer then it will only show the last evaluated tcode instead of a correct Y or N.

Thanks for your help thus far. I'm just missing something.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 5:52am

That is very different than what I understood. For clarification

do you need only a Y returned if ANY row has the MED or SS code (and no N even if some rows are not the SS or MED)
or
do you need both one Y and 1 N returned if the have a tleast one row meeting each condition?
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 31 Jul 2013 at 6:03am
sorry if i confused you there. what i am looking for a Y if any row has SS or MED

OR

an N if NO row has SS or MED.

for testing i tried this in my detail

Fica := Fica + (If instr(Fica,{@Fica})>0 Then "" Else {@Fica});

and that returns 1Y and 1N so then i tried what you suggested with the len-1 in my footer but that only shows N even though it should have been a Y
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 6:26am
If I understand your requirement correctly your going to be irritated...
create one formula as
 
If {ETax.tcode} In ["MED", "SS"] Then "Y" else "N"
 
Insert a summary as the maximum on this field at your group footer
maximum(formula,groupfield)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2013 at 6:29am
you could also change your other formulas if you want...
 
 
//group header
Shared StringVar Fica := "N";

//detail
Fica := If {ETax.tcode} In ["MED", "SS"] Then "Y" else Fica;

// group footer
Shared StringVar Fica := Fica
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 31 Jul 2013 at 6:35am
damnit!! i knew it had to be something silly that i wasn't thinking of. 
IP IP Logged
<< Prev Page  of 3
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.047 seconds.