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

Need to... double parse?

Guest
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

Okay, I have an application that can change frequently, as such, I need to run a query that tells my main query what it needs to update. So one query provides the other all the fields it needs to update. The main query and function are attached. The Insert part works fine, but the values part isn't working. The output looks like
INSERT INTO moves(name, damage, type, accuracy, recoil, minlevel, price, Boxing, Wrestling, TaiKwonDo, Karate, Capoeria, SAMBO, Ninjitsu, KungFu, Kempo, Savate, KickBoxing, MuayThai, description ) VALUES ('Blah', '1', 'Wresting', '25', '13', '7', '5', '#form.Boxing#', '#form.Wrestling#', '#form.TaiKwonDo#', '#form.Karate#', '#form.Capoeria#', '#form.SAMBO#', '#form.Ninjitsu#', '#form.KungFu#', '#form.Kempo#', '#form.Savate#', '#form.KickBoxing#', '#form.MuayThai#', 'Test')

See how it is just plugging #form.Fightingstylename# instead of actually finding the value of that field. How can I make it actually find the value of the field it is creating? I hope this makes sense.
TOPICS
Advanced techniques

Views

288

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 ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

Start with the evaulate() function.

Ninety percent of the time this type of logic can be rewritten to make
it simpler and not need this type of double evaluation.

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
Guest
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

Thanks for the info, I'll check into the evaluate function.
There probably is a better way to do this, but I'm a terrible programmer, so unless you have any better ideas, i think I'm gonna have to roll with 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 ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

see if this works:

<cfloop query="fetchStyles">
<!--- Desired output of this look looks like '#form.boxing#' --->
'#form[ReReplace(fetchStyles.name,"[[:space:]]*","","all")]#',
</cfloop>

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

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
Guest
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

LATEST
Thanks for the reply. This was the magic setup that did the trick...

<cfoutput>
<cfloop query="fetchStyles">
<!--- Desired output of this look looks like '#form.boxing#' --->
<cfset prestring = "##form.">
<cfset poststring = "##">
<cfset mainstring = ReReplace(fetchStyles.name,"[[:space:]]*","","all")>
<cfset wholestring = prestring & mainstring & poststring>
'#evaluate(wholestring)#',
</cfloop>
</cfoutput>

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