I have a dialog box I am trying to make work - I have done this same thing numerous times, but it seems to have an issue when dong it with Dates.
I have two Variable in The Dialog Box - the First V_Date - asks the date you want to start your search on
The second is V_BOL_no - it will then give you a list of the Tickets that are only on or after the V_Date
If I do it as two seperate Dialog boxes - i.e. ask more date, then a second dialog box pops up and gives you list it works.
I want it all in one Dialog Box Where you can change the date and your second list changes as soon as you tab out of the date, based on the new date.
I have tried Converting the Date to a Character field and the Variable to a Character. It will work in a query on the Table
I use action Scripting to do it, and have even tried to modify xbasic - just won't reset the variable
Here is Script - I put in a default date - but when I change the date the list won't update
dim tbl as p
tbl = table.open("number_file")
dim recno as n
recno = 1
'select record number order
tbl.index_primary_put("")
'go to last record in table
tbl.fetch_last()
dim last_record as n
last_record = tbl.recno()
if recno < 0 then
tbl.fetch_goto(last_record)
else
if recno <=last_record then
tbl.fetch_goto(recno)
else
ui_msg_box("Error","Record number is past end of table.",UI_STOP_SYMBOL)
end
end if
end if
DIM Global v_Bol_No AS N
v_Bol_No = tbl.eval("Bol_No")
tbl.close()
'Create a new variable called 'v_date' and set its value to '=date()
dim Global v_date AS D
'v_date = convert_type(a5_eval_expression("=date()",local_variables()),"D")
v_date = convert_type(a5_eval_expression("={04/01/11}",local_variables()),"D")
'Create an XDialog dialog box to prompt for parameters.
'DIM GLOBAL v_Date as D
DIM GLOBAL V_BOL as C
DIM GLOBAL varC_result as C
auto_list_V_BOL = table.external_record_content_get("daily_tickets","alltrim(lookupc(\"F\",Cust_No,\"cust_name\",\"customer\",\"Cust_No\"))+ \" | \"+Date+ \" | \"+lookupc(\"F\",Load_Type_No,\"load_type\",\"load_type\",\"Load_Type_No\")+\" | \"+Daily_No","date","date_ord>= Var->v_date")
Dim format as p
Format.tab_stops=""
Format.odd_row_color="White"
Format.even_row_color="Blue White"
Format.odd_selected_color="Dark Blue"
Format.even_selected_color="Dark Blue"
Format.font="Arial,8"
Format.font_color_unselected="Black"
Format.font_color_selected="White"
Format.lastbutton="OK"
Format.group_size=1
Format.number_rows=.f.
Format.alternating_bands=.t.
'Apply 'owner draw' formatting information to the list
auto_list_V_BOL = a5_owner_draw_list_fmt(auto_list_V_BOL,Format)
temp_count = w_count(auto_list_V_BOL,crlf())
DELETE a_V_BOL
DIM a_V_BOL[temp_count] as c
a_V_BOL.initialize(auto_list_V_BOL)
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Alpha Five",<<%dlg%
{region}
Date of Tickets with no Numbers:| [%DATE%.15v_Date!v_Date_*];
Which BOL do you want to Assign # to:| [%d;O={@@}%.50,15V_BOL^$$a_V_BOL];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%,<<%code%
if left(a_dlg_button,7) = "v_Date_" then
if a_dlg_button = "v_Date_killfocus" then
v_date = ctod(dtoc(v_Date))
end if
a_dlg_button = ""
end if
If a_dlg_button = "v_date_changed" then
v_BOL_No_rl_def = replace_parameters(v_BOL_No_rl_def_orig,local_variables())
a_dlg_button = ""
end if
%code%)
I have two Variable in The Dialog Box - the First V_Date - asks the date you want to start your search on
The second is V_BOL_no - it will then give you a list of the Tickets that are only on or after the V_Date
If I do it as two seperate Dialog boxes - i.e. ask more date, then a second dialog box pops up and gives you list it works.
I want it all in one Dialog Box Where you can change the date and your second list changes as soon as you tab out of the date, based on the new date.
I have tried Converting the Date to a Character field and the Variable to a Character. It will work in a query on the Table
I use action Scripting to do it, and have even tried to modify xbasic - just won't reset the variable
Here is Script - I put in a default date - but when I change the date the list won't update
dim tbl as p
tbl = table.open("number_file")
dim recno as n
recno = 1
'select record number order
tbl.index_primary_put("")
'go to last record in table
tbl.fetch_last()
dim last_record as n
last_record = tbl.recno()
if recno < 0 then
tbl.fetch_goto(last_record)
else
if recno <=last_record then
tbl.fetch_goto(recno)
else
ui_msg_box("Error","Record number is past end of table.",UI_STOP_SYMBOL)
end
end if
end if
DIM Global v_Bol_No AS N
v_Bol_No = tbl.eval("Bol_No")
tbl.close()
'Create a new variable called 'v_date' and set its value to '=date()
dim Global v_date AS D
'v_date = convert_type(a5_eval_expression("=date()",local_variables()),"D")
v_date = convert_type(a5_eval_expression("={04/01/11}",local_variables()),"D")
'Create an XDialog dialog box to prompt for parameters.
'DIM GLOBAL v_Date as D
DIM GLOBAL V_BOL as C
DIM GLOBAL varC_result as C
auto_list_V_BOL = table.external_record_content_get("daily_tickets","alltrim(lookupc(\"F\",Cust_No,\"cust_name\",\"customer\",\"Cust_No\"))+ \" | \"+Date+ \" | \"+lookupc(\"F\",Load_Type_No,\"load_type\",\"load_type\",\"Load_Type_No\")+\" | \"+Daily_No","date","date_ord>= Var->v_date")
Dim format as p
Format.tab_stops=""
Format.odd_row_color="White"
Format.even_row_color="Blue White"
Format.odd_selected_color="Dark Blue"
Format.even_selected_color="Dark Blue"
Format.font="Arial,8"
Format.font_color_unselected="Black"
Format.font_color_selected="White"
Format.lastbutton="OK"
Format.group_size=1
Format.number_rows=.f.
Format.alternating_bands=.t.
'Apply 'owner draw' formatting information to the list
auto_list_V_BOL = a5_owner_draw_list_fmt(auto_list_V_BOL,Format)
temp_count = w_count(auto_list_V_BOL,crlf())
DELETE a_V_BOL
DIM a_V_BOL[temp_count] as c
a_V_BOL.initialize(auto_list_V_BOL)
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Alpha Five",<<%dlg%
{region}
Date of Tickets with no Numbers:| [%DATE%.15v_Date!v_Date_*];
Which BOL do you want to Assign # to:| [%d;O={@@}%.50,15V_BOL^$$a_V_BOL];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%,<<%code%
if left(a_dlg_button,7) = "v_Date_" then
if a_dlg_button = "v_Date_killfocus" then
v_date = ctod(dtoc(v_Date))
end if
a_dlg_button = ""
end if
If a_dlg_button = "v_date_changed" then
v_BOL_No_rl_def = replace_parameters(v_BOL_No_rl_def_orig,local_variables())
a_dlg_button = ""
end if
%code%)