Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: can someone tell me why this isn't returning Post Reply Post New Topic
Page  of 2 Next >>
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: can someone tell me why this isn't returning
     Posted: 24 Jan 2013 at 4:41am
IF LEN (TOTEXT({EPayHist.checkNumber})) = 1 THEN "000000" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 2 THEN "00000" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 3 THEN "0000" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 4 THEN "000" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 5 THEN "00" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 6 THEN "0" & TOTEXT({EPayHist.checkNumber}) ELSE
IF LEN (TOTEXT({EPayHist.checkNumber})) = 7 THEN TOTEXT({EPayHist.checkNumber}) ELSE
IF ISNULL({EPayHist.checkNumber}) THEN "0000000"


it should get the check number and zero fill it to 7 spaces. i can't figure it out. any help would be amazing.

Thank you!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jan 2013 at 5:02am
totext will usually include decimals and comma seperators.
an easier solution is:
totext({EPayHist.checkNumber},"0000000")
 
and make sure the formula option is set to 'use default values for nulls'


Edited by DBlank - 24 Jan 2013 at 5:04am
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 24 Jan 2013 at 5:09am
well, that won't back fill though will it? for instance if the check number is "54" it would need to be converted to "0000054".

when i switched and put the if isnull at the top of the statement it is now returning but only returning "0000000" even though i know that every file is not null and there is real data in the field.

thank you for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jan 2013 at 5:18am
the red condition in it 'back fills'
totext({EPayHist.checkNumber},"0000000")
 
Are you using this in a GH ot GF?
To trouble shoot place the original EPayHist.checkNumber field next to the formula result and make sure that youa re seeing the expected number there.
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 24 Jan 2013 at 5:27am
oh awesome!! I'm not sure what you mean by GH or GF. 
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 24 Jan 2013 at 5:27am
ps, this worked perfectly!!!! thank you! 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jan 2013 at 5:31am
GH = group header
GF= group footer
 
I asked because if you were placing the field/formula in either of those it would be displaying only the result from the first record (header) or last record (footer) of that group. This sometimes trips people up thinking the formula is not working when it is more about where they placed the formula.
Glad you got it working.
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 24 Jan 2013 at 5:36am
gotcha, i have it all in code under details.

question, i have a few other fields that my client wants zero filled so i'm going back to use your suggested way vs the if len code that i had.

some of them work and some say "this statement has too many arguments" what does this mean?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jan 2013 at 5:56am

usually you ar missing a parenth or a comma to indicate that you are using an an addiitional 'argument' of a function (like the "000000" option).

Post an example and I might be able to tease it out.
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 24 Jan 2013 at 6:04am
when i use TOTEXT({ELaborDist.jobcode},"000000") it highlights the qoutes and zero's and says too many arguments.

this again is a field the client wants zero filled so i was using a if len statement.
IP IP Logged
Page  of 2 Next >>
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