Maybe I'm making this harder than it is, but I'm stuck. I'm 
attempting to make a dynamic sql insert, and am lost on what seems to 
be an 'evaluate' or 'nested variable' issue.   I looked at the 
evaluate function in Forta and CFStudio docs, both of which used such 
a simple example I can't decide if it even relates to what I need to 
do, though the name sounds right.

I need to get one variable to evaluate inside of another variable, 
and the second (outer) variable has to evaluate including the now-
translated-inner variable as part of its var name.  This is being 
done inside an insert query.

I have a user form that loops "sets" of Q&A information down the 
page.  Though the template is the same cfinclude, each fieldname is 
made unique by appending an incremental integer (e.g., fielda7, 
fieldb7, fielda8, fieldb8, etc.).  I want to make the insert 
statement dynamic, so ONE insert statement will cover the differently-
named fields, in their 'sets', for however many there might be.  (I 
can't use normal list functions for this, I won't bore you with why.)

I've got the first part down okay I think.  I use a FOR cfloop around 
the insert, and it generates a value (qid) that starts at 1 and steps 
by 1 up to the total Q&A qty value passed from the form page.  The 
qid value appends to the fieldnames:

insert into table (fielda#qid#,fieldb#qid#)

But when I get to inserting the actual values, then I'm in trouble.  
My logic (wrong syntax of course) needs to go like this:

values ('#form.fielda#qid##','#form.fieldb#qid##' ....)

qid has to be defined first, then the formfielda WITH the increment 
value stuck on it (say "7" like fielda7) has to be evaluated, as 
that's the value that's getting passed from the user form.  In CF 
docs the evaluate function is shown on strings (or just one var, not 
one-inside-one) so I can't figure out how (or if) I would use the 
evaluate syntax to get the result I want.

Anybody have experience in this?

Many weary thanks,
Palyne


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to