I have a menu form in our helpdesk application that I want to display a message stating the last time the application checked for messages.
There is a table called getmsgtime that has 1 record with two fields, last_update_date and last_update_time. This record gets updated by another script that runs when messages are checked. That part works fine.
I created a script named show_something, and added a button on the menu form to call this script. The script works fine every time if you just run it from the code page, but when I run it from the button on the menu, I get an error message that it can't find the table. I've tried all sorts of things but can't get it to work from the menu button. Thanks for looking at this!!
Here's the script code:
tbl = table.open("getmsgtime")
query.filter = ""
query.order = ""
DIM form_name as C
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
DIM vTestDialog as C
DIM SHARED varC_result as C
'tbl = table.open("getmsgtime")
'query.filter = ""
'query.order = ""
DELETE expression_result
expression_result = eval("\"DATE \"+tbl.last_update_date+\" TIME \"+tbl.last_update_time"" ",form_name)
vText1 = " MESSAGE CHECK"
vText2 = "Incoming Messages Last Checked : "
vText3 = expression_result
dlg_code = <<%dlg%
{can_exit=close}
{background=Black}
{'%O={F=Arial,10,B}{C=Pale Blue}{I:'$sys_information'} Text1%};
{line=0}
{'%O={F=Arial,10,B}{C=Light Green} Text2% };
{'%O={F=Arial,10,B}{C=Light Green} Text3% };
%dlg%
dlg_event = <<%Code%
if a_dlg_button = "close"
ui_modeless_dlg_close("Notice")
end if
%code%
dlg_code = stritran(dlg_code,"Text1",vText1)
dlg_code = stritran(dlg_code,"Text2",vText2)
dlg_code = stritran(dlg_code,"Text3",vText3)
ui_modeless_dlg_box("Notice",dlg_code,dlg_event)
There is a table called getmsgtime that has 1 record with two fields, last_update_date and last_update_time. This record gets updated by another script that runs when messages are checked. That part works fine.
I created a script named show_something, and added a button on the menu form to call this script. The script works fine every time if you just run it from the code page, but when I run it from the button on the menu, I get an error message that it can't find the table. I've tried all sorts of things but can't get it to work from the menu button. Thanks for looking at this!!
Here's the script code:
tbl = table.open("getmsgtime")
query.filter = ""
query.order = ""
DIM form_name as C
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
DIM vTestDialog as C
DIM SHARED varC_result as C
'tbl = table.open("getmsgtime")
'query.filter = ""
'query.order = ""
DELETE expression_result
expression_result = eval("\"DATE \"+tbl.last_update_date+\" TIME \"+tbl.last_update_time"" ",form_name)
vText1 = " MESSAGE CHECK"
vText2 = "Incoming Messages Last Checked : "
vText3 = expression_result
dlg_code = <<%dlg%
{can_exit=close}
{background=Black}
{'%O={F=Arial,10,B}{C=Pale Blue}{I:'$sys_information'} Text1%};
{line=0}
{'%O={F=Arial,10,B}{C=Light Green} Text2% };
{'%O={F=Arial,10,B}{C=Light Green} Text3% };
%dlg%
dlg_event = <<%Code%
if a_dlg_button = "close"
ui_modeless_dlg_close("Notice")
end if
%code%
dlg_code = stritran(dlg_code,"Text1",vText1)
dlg_code = stritran(dlg_code,"Text2",vText2)
dlg_code = stritran(dlg_code,"Text3",vText3)
ui_modeless_dlg_box("Notice",dlg_code,dlg_event)
Comment