Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert date array parameter to string array

Status
Not open for further replies.

chris35

Technical User
Apr 21, 2003
24
US
How do I convert a date array parameter to a string and how to use in a formula so the entire array displays?
I have tried the follwoing but to no avail:

numbervar counter;
stringvar holder;
counter := count({?Result Date});
while counter > 0 do
(holder := holder + {?Result Date}[counter] + ',';
counter := counter - 1);
holder [1 to (length(holder)-1)]

Thanks for any help.
 
You omitted the conmversion to text:

numbervar counter;
stringvar holder;
counter := count({?Result Date});
while counter > 0 do
(holder := holder + TOTEXT({?Result Date}[counter]) + ',';
counter := counter - 1);
holder

If it's a date range, rather than multiple values, try:

"Dates: "+totext(minimum({?Result Date}))+" to "+totext(maximum({?Result Date}))

-k
 
Is your Parameter in actuality a string...looking like a date...or a real date datatype

If it is just a string array this is all that is necessary

WhilePrintingRecords;
StringVar result;

result := Join({?Result Date},", ");

if it is in truth a date then I would convert it to a string array first

WhilePrintingRecords;
StringVar result;

//boy it would be nice if this worked...not sure though
//otherwise you must change each array element individually

StringVar array temp := totext({?Result Date},"dd/MM/yyyy")

result := Join(temp,", ");




Jim Broadbent
 
Nice thought Jim, but Crystal doesn't allow that...

They were on the right track, they had just omitted the totext()

-k
 
Thanks a lot for the formulas.

"Dates: "+totext(minimum({?Result Date}))+" to "+totext(maximum({?Result Date}))

This one worked fine.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top