Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Changing string field format Post Reply Post New Topic
Author Message
rjjj1111
Newbie
Newbie


Joined: 04 Feb 2013
Online Status: Offline
Posts: 5
Quote rjjj1111 Replybullet Topic: Changing string field format
     Posted: 05 Feb 2013 at 7:32am
I have a string field 850315
 
I need to change it to 03-15-85
 
what is the code to do this inside a formula?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Feb 2013 at 9:13am
try
picture(field,"xx-xx-xx")
IP IP Logged
rjjj1111
Newbie
Newbie


Joined: 04 Feb 2013
Online Status: Offline
Posts: 5
Quote rjjj1111 Replybullet Posted: 05 Feb 2013 at 9:36am
that result brought back 85-03-15 for string 850315
 
i need 03-15-85
 
any suggestions?
 
what about left right mid function on the field?
 
would that work? if so what is the code?


Edited by rjjj1111 - 05 Feb 2013 at 9:37am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Feb 2013 at 9:54am
oops sorry. I did not look close enough.
Are you trying to make this into a date?
IP IP Logged
rjjj1111
Newbie
Newbie


Joined: 04 Feb 2013
Online Status: Offline
Posts: 5
Quote rjjj1111 Replybullet Posted: 05 Feb 2013 at 11:01am
yes, but it is for display only. so it could stay a string
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Feb 2013 at 11:46am

ok you can use the left mid or right

picture((right(field,4)+left(field,2)),'xx-xx-xx')
IP IP Logged
rjjj1111
Newbie
Newbie


Joined: 04 Feb 2013
Online Status: Offline
Posts: 5
Quote rjjj1111 Replybullet Posted: 05 Feb 2013 at 11:52am
I was trying to do something like this but i could not get the mid function working correctly? I am not sure what i was doing incorrect?
 
date(tonumber(mid({Command.AP1VALDATE},3,2)),tonumber(right({Command.AP1VALDATE},2)),tonumber(left({Command.AP1VALDATE},2)))
 
does anyone have any suggestions?
 
 


Edited by rjjj1111 - 05 Feb 2013 at 11:53am
IP IP Logged
rjjj1111
Newbie
Newbie


Joined: 04 Feb 2013
Online Status: Offline
Posts: 5
Quote rjjj1111 Replybullet Posted: 05 Feb 2013 at 11:58am
DBlank sorry i missed your earlier post.
 
that worked perfect............thanks......!!!!!
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