• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

The value '' cannot be converted to a number: Help anyone

Participant ,
Oct 23, 2009 Oct 23, 2009

Copy link to clipboard

Copied

Good morning all,

I have this query below, it works fine when I select a start date with a single digit day, ie. 9/7/2009. But any selected start date after the week containing 9/7/2009 I get this error:

The value '' cannot be converted to a number

SELECT     DATEADD(wk, DATEDIFF(wk, 0, DateProd), 0) AS Weekly_Production, sum(UnitsProd) AS Total_Units
FROM         tbl_Assembly_Production
WHERE dateProd Between '#FORM.dateFROM#' and '#FORM.dateTo#'
GROUP BY DATEADD(wk, DATEDIFF(wk, 0, DateProd), 0)
ORDER BY Weekly_Production

Has anyone seen this before? I've checked my table and all the dates seem good.

Thanks in advance,

djkhalif

TOPICS
Advanced techniques

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2009 Oct 23, 2009

Copy link to clipboard

Copied

Chances are your query is not returning any records and the error occurs when you try to process it.  Either cfdump it or look at your debugging info to verify this.  Other comments:

This:

DATEADD(wk, DATEDIFF(wk, 0, DateProd), 0) AS Weekly_Production

is very strange.  Datediff returns a number and DateAdd returns a date.  When you say that it works fine under certain circumstances, it might be running error free but could be giving you an incorrect answer.

This:

WHERE dateProd Between '#FORM.dateFROM#' and '#FORM.dateTo#'
has two or three problems.  The first is that you did not convert the strings to date objects.  The second is that you are not using cfqueryparam.  The third is that, if the datatype of dateProd has a date and time, you may be missing records.  Better logic would be

where proddate >= date1

and proddate < the day after date 2

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 23, 2009 Oct 23, 2009

Copy link to clipboard

Copied

Dan,

Thanks. I will try that this weekend.

djkhalif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 24, 2009 Oct 24, 2009

Copy link to clipboard

Copied

Dan,

I uploaded my coded; would you mind looking at it?

Thanks,

djkhalif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 24, 2009 Oct 24, 2009

Copy link to clipboard

Copied

Dan,

I posted my code; would you mind looking at it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 24, 2009 Oct 24, 2009

Copy link to clipboard

Copied

Where did you post it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 25, 2009 Oct 25, 2009

Copy link to clipboard

Copied

Dan,

I thought it had uploaded but it didn't happen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 26, 2009 Oct 26, 2009

Copy link to clipboard

Copied

LATEST

Dan,

I found the problem. When I duped the pages all of the queries from the original were still on the duped pages. I removed the unnecessary <cfquery>'s from the pages and now they work fine.

Thanks,

djkhalif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation