Forum OpenACS Q&A: problem with index.tcl: Too many positional parameters specified while executing

Hello,

I´m working with "OpenACS_Tutorial.pdf" (https://openacs.org/storage/view/tutorial%5C/OpenACS_Tutorial.pdf)
code : pages 39, it's I get the following error:

Too many positional parameters specified
while executing
"template::list::create__arg_parser"
(procedure "template::list::create" line 1)
invoked from within
"template::list::create \ "
("uplevel" body line 11)
invoked from within
"uplevel {
ad_page_contract {
This page will display a list of to do items belonging to the current user.
} {
orderby ptional
}

set page_t..."
(procedure "code::tcl::/usr/share/openacs/packages/todo/www/index" line 2)
invoked from within
"code::tcl: __adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure
"adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/[ad_conn extra_url]""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/[ad_conn extra_url]"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl..."

someone could help me please.

Hi Juan,

First, the ad_page_contract block should read:

ad_page_contract {
This page will display a list of to do items belonging to the current user.
} {
orderby:optional
}

Regarding the error, it seems there's a syntax error when calling template::list::create. Please, paste that part of the code to see what's wrong in it.

Hello

Also I have the same problem here's the part of the code attached

ad_page_contract {
 This page will display a list of to do items belonging to the current user.
} {
 orderby:optional
}

set page_title "My To Do List"
set user_id [ad_conn user_id]

template::list::create -name todo_list\
 -multirow todo_list_mr\
 -elements {
      title {
         label "Task"
         link_url_col item_url
         link_html {title "Click to view this item details" }
      }
      due_date_pretty {
      label "Due Date"
      }
     status_text {
    label "Status"
     }
    creation_date_pretty {
      label "Creation Date"
    }
    view {
       display_template "View"
       link_url_col item_url
      }
    delete {
        display_template "Delete"
        link_url_col delete_url
    }
    completed {
        display_template "Mark Completed"
        link_url_col completed_url
    }
    cancel {
        display_template "Cancel"
        link_url_col cancel_url
    }
 }
-orderby {
  title {orderby title}
  due_date_pretty {orderby due_date}
  status_text {orderby status}
  creation_date_pretty {orderby creation_date}
} -actions {
  "Add New Task" "todo-ae" "Click here to add a new item to the list"
}

if {[exists_and_not_null orderby]} {
    set orderby_clause "ORDER BY [template::list::orderby_clause -name todo_list]"
} else {
    set orderby_clause "ORDER BY due_date asc"
}

db_multirow -extend { item_url delete_url cancel_url completed_url status_text } todo_list_mr todo_list_mr \
"select item_id,
        title,
        due_date,        
        to_char(due_date, 'Month DD YYYY ') as due_date_pretty,
        creation_date,        
        to_char(creation_date, 'Month DD YYYY ') as creation_date_pretty,
        status
  from todo_item
  where owner_id = :user_id
  $orderby_clause

" {

  set form_mode display
  set item_url "todo-ae?[export_vars -url { item_id form_mode }]"

  switch $status {
   p {set status_text "Pending"}
   c {set status_text "Completed"}  
   x {set status_text "Canceled"}
   default {set status_text "Unknown" }
  }

  set return_url [util_get_current_url]
  set delete_url "todo-delete?[export_vars -url {item_id return_url}]"

  if { $status != "c" } {
      set new_status completed
      set completed_url "todo-update-item?[export_vars -url {item_id new_status return_url}]"
  }
  if { $status != "x" } {
      set new_status canceled
      set cancel_url "todo-update-item?[export_vars -url {item_id new_status return_url}]"
   }
}

thanks ...

Hi Jhon

you are missing a backslash on the line before the -orderby. Also I think you should have a space before the other backslashes.

Brian

Hi Brian

thank you very much for responding, corrected as you said and indeed that was the error

Now I get different other error in the tcl code same:

No value specified for argument sql
while executing
"db_multirow__arg_parser"
(procedure "db_multirow" line 1)
invoked from within
"db_multirow -extend { item_url delete_url cancel_url completed_url status_text } todo_list_mr todo_list_mr"

("uplevel" body line 53)
invoked from within
"uplevel {
ad_page_contract {
This page will display a list of to do items belonging to the current user.
} {
orderby:optional

}
set page_titl..."
(procedure "code::tcl::/usr/share/openacs/packages/todo/www/index" line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {


# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {


if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within

"adp_prepare"
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"

("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing

}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/[ad_conn extra_url]""

("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/[ad_conn extra_url]"
set tcl_url2file([ad_conn url]) [ad_conn file]

set tcl..."
_______________________________________________________

I put the keys after: db_multirow -extend { item_url delete_url cancel_url completed_url status_text } todo_list_mr todo_list_mr

and closed after: $orderby_clause"

but I have the same error.
Please Could u Help me.

code here :

ad_page_contract {
This page will display a list of to do items belonging to the current user.
} {
orderby:optional
}
set page_title "My To Do List"
set user_id [ad_conn user_id]
template::list::create -name todo_list \
-multirow todo_list_mr \
-elements {
title {
label "Task"
link_url_col item_url
link_html {title "Click to view this item details" }
}
due_date_pretty {
label "Due Date"
}
status_text {
label "Status"
}
creation_date_pretty {
label "Creation Date"
}
view {
display_template "View"
link_url_col item_url
}
delete {
display_template "Delete"
link_url_col delete_url
}
completed {
display_template "Mark Completed"
link_url_col completed_url
}
cancel {
display_template "Cancel"
link_url_col cancel_url
}
} -orderby {
title {orderby title}
due_date_pretty {orderby due_date}
status_text {orderby status}
creation_date_pretty {orderby creation_date}
} -actions {
"Add New Task" "todo-ae" "Click here to add a new item to the list"
}
if {[exists_and_not_null orderby]} {
set orderby_clause "ORDER BY [template::list::orderby_clause -name todo_list]"
} else {
set orderby_clause "ORDER BY due_date asc"
}
db_multirow -extend { item_url delete_url cancel_url completed_url status_text } todo_list_mr todo_list_mr
" select item_id,
title,
due_date,
to_char(due_date, 'Month DD YYYY ') as due_date_pretty,
creation_date,
to_char(creation_date, 'Month DD YYYY ') as creation_date_pretty,
status
from todo_item
where owner_id = :user_id"
$orderby_clause"
{
set form_mode display
set item_url "todo-ae?[export_vars -url { item_id form_mode }]"
switch $status {
p {set status_text "Pending"}
c {set status_text "Completed"}
x {set status_text "Canceled"}
default {set status_text "Unknown" }
}
set return_url [util_get_current_url]
set delete_url "todo-delete?[export_vars -url {item_id return_url}]"
if { $status != "c" } {
set new_status completed
set completed_url "todo-update-item?[export_vars -url {item_id new_status return_url}]"
}
if { $status != "x" } {
set new_status canceled
set cancel_url "todo-update-item?[export_vars -url {item_id new_status return_url}]"
}
}

Hi Juan,

You have an extra quote in your SQL query text after "owner_id = :user_id".

Using indentation and syntax highlighting may help you spotting those errors.

... and there is backslash missing at the end of the line starting with db_multirow -extend .... In your previous posting, it was there.