glthornton
Programmer
Hi,
I'm using CR XI with and SQL ODBC connection. I'm having problem trying to get a properly formatted date string when using the ToText command. Here is my formula:
What I am currently getting for an end result looks like this: "5.007.002007.00-1" and "5.007.002007.00-2", etc. What I'd really like the string value to look like is "05072007-1". But I'd even be happy without the leading zeros like this: "572007-1". Does anyone know how I can do this? Or can someone show me how to prevent the decimals from being converted to text?
Thank you,
glthornton
I'm using CR XI with and SQL ODBC connection. I'm having problem trying to get a properly formatted date string when using the ToText command. Here is my formula:
Code:
// Clear Variables
NumberVar Mon1 :=0;
NumberVar Day1 :=0;
NumberVar Yr1 :=0;
StringVar Mon2 := "";
StringVar Day2 := "";
StringVar Yr2 := "";
StringVar FinDT:= "";
//Set DT variable to today's date in text format
shared NumberVar IndID:=IndID+1;
StringVar StrIndID:=ToText(IndID,0);
//Set Month, Day, Year Variables
NumberVar Mon1:=DatePart ("m",CurrentDate);
NumberVar Day1:=DatePart ("d",CurrentDate);
NumberVar Yr1:=DatePart ("yyyy",CurrentDate);
//Convert Month, Day, Year Variables to Text
StringVar Mon2:=ToText(Mon1);
StringVar Day2:=ToText(Day1);
StringVar Yr2:=ToText(Yr1);
//Set Final Date (FinDT) to today + Incremented counter variable
StringVar FinDT:=Mon2+Day2+Yr2+"-"+StrIndID;
What I am currently getting for an end result looks like this: "5.007.002007.00-1" and "5.007.002007.00-2", etc. What I'd really like the string value to look like is "05072007-1". But I'd even be happy without the leading zeros like this: "572007-1". Does anyone know how I can do this? Or can someone show me how to prevent the decimals from being converted to text?
Thank you,
glthornton