Hi,
I have some code that updates all indexs and packs the tables in the database. This runs from the code tab and by selecting run.
I want to run this from my application using a button. When i cut and pasted the code into an a5w page and ran it from a button on my maintenance page, the script came up in an error.
500 Internal Server Error
"Script Error
Error:a5.table_enum() cannot be used in the Application Server."
Can anyone advise how i can get this to work from a a5w page?
Thanks
Denis
I have some code that updates all indexs and packs the tables in the database. This runs from the code tab and by selecting run.
I want to run this from my application using a button. When i cut and pasted the code into an a5w page and ran it from a button on my maintenance page, the script came up in an error.
500 Internal Server Error
"Script Error
Error:a5.table_enum() cannot be used in the Application Server."
Can anyone advise how i can get this to work from a a5w page?
Code:
<%a5 omit_tables = "" dim table_list as c table_list = a5.table_enum(2) if omit_tables <> "" then tables_to_update = word_subtract(table_list,omit_tables,crlf()) else tables_to_update = table_list end if dim count as n count = w_count(tables_to_update,crlf()) dim i as n dim tbl as p for i = 1 to count statusbar.percent(i,count) table_i = word(tables_to_update,i,crlf()) tbl = table.open(table_i) tbl.update_production_index() tbl.close() next i 'Pack all of the tables in the Database. omit_tables = "" dim table_list as c table_list = a5.table_enum(2) if omit_tables <> "" then table_list = word_subtract(table_list,omit_tables,crlf()) end if 'check if any tables are in use. the *for_each() funtion loops through each table 'and returns a crlf delimited string with table_filename|True, or table_filename|False in_use = *for_each(x,x+"|"+table.in_use(x),table_list) tables_in_use = filter_string(in_use,"|True",crlf()) tables_in_use = stritran(tables_in_use,"|True","") tables_to_update = filter_string(in_use,"|False",crlf()) tables_to_update = stritran(tables_to_update,"|False","") dim count as n count = w_count(tables_to_update,crlf()) dim i as n dim tbl as p for i = 1 to count statusbar.percent(i,count) table_i = word(tables_to_update,i,crlf()) tbl = table.open(table_i) tbl.pack() tbl.close() next i if tables_in_use <> "" then count = w_count(tables_in_use,crlf()) if count = 1 then msg = "1 table could not be packed because the table was in use." + crlf(2) +\ tables_in_use else msg = ""+ count+ " tables could not be packed because the tables were in use." + crlf(2) +\ tables_in_use end if ui_msg_box("Notice",msg,ui_information_symbol) end if %>
Denis
Comment