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!

String is non Numeric

Status
Not open for further replies.

sjdbmc

IS-IT--Management
Jan 30, 2004
14
GB
numberVar Conversion_Year := tonumber(Mid (totext({insurance_details.complete_by_dt}),7,4));
numberVar Conversion_Month := tonumber(Mid (totext({insurance_details.complete_by_dt}),4,2));
numberVar Conversion_Day := tonumber(Mid (totext({insurance_details.complete_by_dt}),1,2));
numberVar Conversion_Hours := tonumber(Mid (totext({insurance_details.complete_by_tm}),12 ,3 ));
numberVar Conversion_Minutes := tonumber(Mid (totext({insurance_details.complete_by_tm}),16 ,2 ));
numberVar Conversion_Seconds := tonumber(Mid (totext({insurance_details.complete_by_tm}),19 ,2 ));

if not isnull({insurance_details.complete_by_dt}) and not isnull({insurance_details.complete_by_tm}) then
DateTime(Conversion_Year,Conversion_Month,Conversion_Day,Conversion_Hours,Conversion_Minutes,Conversion_Seconds)

I have used the above to combine a date field and a time field so they can be sorted and the earliest extracted. On my machine with CR v6 installed it works excatly as is should the compiled .exe also works fine. However when i run the .exe on other machines it reports the error String is Non Numeric.

Any ideas?
 
Add another condition in your RHS: IsNumeric and default with zero or other values so that it never fails
 
Firstly try:

numberVar Conversion_Year := tonumber(Mid (totext({insurance_details.complete_by_dt}),7,4));
numberVar Conversion_Month := tonumber(Mid (totext({insurance_details.complete_by_dt}),4,2));
numberVar Conversion_Day := tonumber(Mid (totext({insurance_details.complete_by_dt}),1,2));
numberVar Conversion_Hours := tonumber(Mid (totext({insurance_details.complete_by_tm}),12 ,2 ));
numberVar Conversion_Minutes := tonumber(Mid (totext({insurance_details.complete_by_tm}),15 ,2 ));
numberVar Conversion_Seconds := tonumber(Mid (totext({insurance_details.complete_by_tm}),18 ,2 ));

But I would use the following as it's neater and easier to read:

Local StringVar DateString := ToText({insurance_details.complete_by_dt},"yyyyMMddHHmmss");
NumberVar Conversion_Year := ToNumber(Mid(DateString,1,4));
NumberVar Conversion_Month := ToNumber(Mid(DateString,5,2));
NumberVar Conversion_Day := ToNumber(Mid(DateString,7,2));
NumberVar Conversion_Hours := ToNumber(Mid(DateString,9,2));
NumberVar Conversion_Minutes := ToNumber(Mid(DateString,11,2));
NumberVar Conversion_Seconds := ToNumber(Mid(DateString,13,2));

Hope this helps....
(ps sorry if the format is incorrect for CR v6 as this was tested using CR v10)

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
I've managed to sort it myself. Regional settings on on individual machines needed changing to pick up correct date format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top