freelanceprogrammers.org Forum Index » Cold Fusion

Dynamically Building Query Strings


View user's profile Post To page top
Chrystalheart Posted: Mon Jul 25, 2005 7:25 pm


Joined: 05 Apr 2005

Posts: 37
Dynamically Building Query Strings
I am trying to dynamically build a query string on the fly,
determining field names as I go. Here is a snippet of what I have
tried.

<cfif #fields.FIELD_TYPE# is "num">
<cfset values="##new_tbl."&#fields.FIELD#&"##">
<cfif #isNumeric(values)#>
<cfelse>
<cfset values="``">
</cfif>
</cfif>

The value of "values" is ending up being literally #new_tbl.Test1#
instead of the value of #new_tbl.Test1#. What am I doing wrong?

Jen
Reply with quote
Send private message
View user's profile Post To page top
somedude8theweb Posted: Mon Jul 25, 2005 9:25 pm


Joined: 02 Apr 2005

Posts: 20
Dynamically Building Query Strings
You might try something like this:
Build a string first
<cfset mystring = "new_tbl#fields.fieldname#">
Then evaluate it, and use that in your statement below:
<cfset myevaluatedstring = "#evaluate(mystring)#">



Mark Gregory

----- Original Message -----
From: "Jennifer" <chrystalheart@...>
To: <cold_fusion@yahoogroups.com>
Sent: Monday, July 25, 2005 7:25 AM
Subject: [cold_fusion] Dynamically Building Query Strings


> I am trying to dynamically build a query string on the fly,
> determining field names as I go. Here is a snippet of what I have
> tried.
>
> <cfif #fields.FIELD_TYPE# is "num">
> <cfset values="##new_tbl."&#fields.FIELD#&"##">
> <cfif #isNumeric(values)#>
> <cfelse>
> <cfset values="``">
> </cfif>
> </cfif>
>
> The value of "values" is ending up being literally #new_tbl.Test1#
> instead of the value of #new_tbl.Test1#. What am I doing wrong?
>
> Jen
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
Reply with quote
Send private message
View user's profile Post To page top
Chrystalheart Posted: Mon Jul 25, 2005 9:35 pm


Joined: 05 Apr 2005

Posts: 37
Dynamically Building Query Strings
Thanks Mark.. I`ll give it a shot!

Jen

--- In cold_fusion@yahoogroups.com, "YahooDude" <yahoodude@s...> wrote:
> You might try something like this:
Reply with quote
Send private message
View user's profile Post To page top
Chrystalheart Posted: Mon Jul 25, 2005 10:15 pm


Joined: 05 Apr 2005

Posts: 37
Dynamically Building Query Strings
Works like a charm! Thanks!

Jen

--- In cold_fusion@yahoogroups.com, "YahooDude" <yahoodude@s...> wrote:
> You might try something like this:
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help