Forum OpenACS Q&A: some help with ad_table

Collapse
Posted by abbas beginner on
Hi,

im just having a little problem with ad_table, im trying to use a variable that is inputted into the perl script inside the table definition , but because the variable is not from the ad_table query it is not recognising it

heres an example of what im trying to do

ad_page_contract {

} {
sid:integer
} -properties {
table
}

set table def {
{add "" {} {<td><a href="addsubject?[export_vars {sid}]"></a></td>}}
}

set table [ad_table myquery {*SQL*} $table]

by putting sid inside the tabledef obviously it doesnt recognise it as it is not in the myquery variable

so how can i get it to be useable inside the definition ?

any help is appreciated

thankyou

}

Collapse
Posted by Andrew Piskorski on
Perl script? What?

As far as your actual problem, there may be other ways to do it (I don't remember), but the easiest solution is just to include the value of your variable sid in your query. If your query is currently doing this:

select a, b from mytable
then simply change it to this instead:
select a, b, :sid as sid from mytable