ODBiC Discussion Board

set variable to string containing variables to be evaluated later

by tom, July 19, 2005 14:06

I need to set a variable to a string that contains other variables but I don't want them evaluated until they are used... not when they are set. The $eval command sounded promising, haven't gotten that to work yet though. $varstr was another possiblity, no luck there. I think even if I get $eval working I'm going to have trouble with one... it's a javascript link so there won't be a way to stop the javascript from processing. So disregard that part of this code unless you know of another way to do operation confirmations. I may do a small html confirmation window... seems I did that once before somewhere to workaround a similar issue.

So here's the if statement, need to print a string then set a url based on the $function$ variable:

<!--if $function$ = delete --> <h2>Select the procedure to delete:<br></h2> <!--set urlString = $eval(javascript:removeProc("$title$", $id$)) --> <!--else if $function$ = update --> <h2>Select the procedure to update / revise:<br></h2> <!--set urlString = $eval(/cgi-bin/odbic/odbic.exe/MainFrame/library/Document Library/procedures/admin/modify.htm?modid=$id$) --> <!--else --> <h2>Procedures:<br></h2> <!--set urlString = $eval(\\hunal-fps01\shares\JLENS\JLENS Website\Library\Document Library\Procedures\PP.JLENS.$category$-$docnumber$$revision$.$filetype$ --> <!--endif-->

what a mess huh?

then I start a table, print the table header row, then attempt to process each row of the sql query with the value of urlString being part of one column. This is where I want the variables to be evaluated:

<!--eachrow--> <tr align='center'><td><a href=$urlString$>PP.JLENS.$category$-$docnumber$$revision$</a></td><td>$title$</td><td>$author$</td><td>$sdate$</td></tr> <!--endrow-->

I've gotten all sorts of weird results by trying different combinations of $eval on the entire url vs. $eval on individual variables, putting quotes here and there, using $url and $varstr... figured it was time to ask the experts.

I have it working with a workaround of testing the $function$ variable twice... once above the table to get the string to print, then once below the table to get the url. That's just bad programming though... would prefer to fix it.



Post Your Reply:

E-mail  optional

HTTP Link: 
Link text: 


Copyright ©1997-2003, Roger Harris. All rights reserved.