Forum Post: EVAL block with variable inside?

  • Thread starter Thread starter gwf
  • Start date Start date
Status
Not open for further replies.
G

gwf

Guest
I want to be able to concatenate an EVAL block so that I can use variables within the block, something like: var1 = "'value'"; var ev1 = "#EVAL[rbv_api.getCount(123456789, 'picklist_field', var1)]"; alert(ev1); (In order to cycle through the values in a picklist and get the count for each.) But that doesn't return anything, although this does when a variable holds the entire string: var ev1 = "#EVAL[rbv_api.getCount(123456789, 'picklist_field', 'value')]"; alert(ev1); * returns the correct number from the EVAL operation And then when I try different ways of concatenating the EVAL block, I get different results but none that work: var ev1 = "rbv_api.getCount(123456789, 'picklist_field', 'value')"; alert(#EVAL[ev1]); * returns nothing var ev1 = "#EVAL[rbv_api.getCount(123456789, 'picklist_field', "; // breaking the string into two pieces var ev2 = "'value')]"; var ev3 = ev1 + ev2; alert(ev3); * returns nothing var ev1 = "#"; var ev2 = "EVAL[rbv_api.getCount(123456789, 'picklist_field', 'value')]"; // var ev3 = ev1 + ev2; alert(ev3); * returns string “#EVAL[rbv_api.getCount(123456789, 'picklist_field', 'value')]” How can I run an EVAL block with a variable inside? Thank you, Greg

Continue reading...
 
Status
Not open for further replies.
Back
Top