Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formatting Results of Concatenated Fields Post Reply Post New Topic
Author Message
preacher_g
Newbie
Newbie
Avatar

Joined: 30 Dec 2008
Online Status: Offline
Posts: 8
Quote preacher_g Replybullet Topic: Formatting Results of Concatenated Fields
    Posted: 12 Jan 2009 at 9:20am
I am trying to put 2 fields together, but it's not easy as straight concantenation...

First, field one is a timestamp / field two is a number.  Both fields need to be 'brought together' with a dash between them.
Second, field one has to be formatted YYYYMMDDHHMMSS (no spaces, no separators). Field two has to be formatted as a whole number, NO Decimals (currently comes up 1.00, 2.00, etc)
So, the output for 1/12/2009  10:58:33AM with the added number 1 should end up looking like: 20090112105833-1
(Currently I get 1/12/2009  10:58:33AM-1.00)

Field one is the result of a formula (that I received from this forum http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5114) and field two is the result of a formula using PageN as the starting point.  The report will be formatted for labels - 14 per page and there will only be one page.

I may change the timestamp use CurrentDateTime as I may not need the functionality of the formulas documented above.  Therefore the CurrentDateTime will be field one.

After all is said and done, THEN I can barcode it...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jan 2009 at 9:56am
Try this formula:
totext({datefield},"yyyy") +
totext({datefield},"MM") +
totext({datefield},"dd") +
totext({datefield},"hh") +
totext({datefield},"mm") +
totext({datefield},"ss") +
"-" +
totext({formulafield},0,'')
IP IP Logged
preacher_g
Newbie
Newbie
Avatar

Joined: 30 Dec 2008
Online Status: Offline
Posts: 8
Quote preacher_g Replybullet Posted: 13 Jan 2009 at 4:43am
Yep - That'll do it!

Thanks!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 13 Jan 2009 at 6:23am
DBlank works, I just hate typing...
 
totext({datefield}, "yyyyMMddhhmmss") + "-" + totext({formulafield},0,"")
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2009 at 7:34am

Thanks lockwelle - I didn't know you could identify more than one part per totext alteration. 

I hate typing too Clap
IP IP Logged
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.031 seconds.