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

Data format conversion issue

Explorer ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

I have a problem with data being corrupted in transit from a form to a query to output. Here is the statement:

QuerySetCell(PartsOrdered, "Part",evaluate('form.partno#Counter#'));

However, what is happening is, when a part number gets passed in that looks like 110-25-5 (which is, BTW, rather typical), it is being converted to a datetime object.

I googled the issue of the Evaluate() method, and I'm aware it's a problem. However, I've tried a few different configurations to maintain the data format, and none work.

Suggestions?
TOPICS
Advanced techniques

Views

591

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

correct answers 1 Correct answer

Participant , Apr 20, 2007 Apr 20, 2007
Check out the documentation for queryNew. You can specify a list of datatypes for your columns. Make sure you specify VarChar for your Part column.

Votes

Translate

Translate
LEGEND ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

pblecha wrote:

> Suggestions?

The highly preferred array notation method. querySetCell(ParsOrdered,
form["partno" & counter]); Look ma no evaluate.

But it looks like you where correctly getting the form value, but that
it is being interpreted as a date. Do you define the data types for the
query you are building? How else is this data being used?

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 ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

Evaluate is definitely not an efficient way to do anything... it should really be avoided in CF.

For this, try the following:

QuerySetCell(PartsOrdered, "Part",form["partno#Counter#"]);

Your syntax for evaluate is correct, btw, so you might run into the same issue here.

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
Explorer ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

Yes, it's still returning the same datetime object.

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 ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

pblecha wrote:
> Yes, it's still returning the same datetime object.

What does your queryNew() function look like?

How are you outputing the value?

What else might you be doing to the value in between?

What does <cfoutput>#form["partno" & counter]#<cfoutput> at the
beginning of the page show?


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 ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

Check out the documentation for queryNew. You can specify a list of datatypes for your columns. Make sure you specify VarChar for your Part column.

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
Explorer ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

LATEST
quote:

Originally posted by: joeDangelo
Check out the documentation for queryNew. You can specify a list of datatypes for your columns. Make sure you specify VarChar for your Part column.


This worked. Thanks.

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
New Here ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

what about using Evaluate(DE(form["partno#Counter#"]))

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