Can anyone please tell me why this script does not proceed to open the form 'Tx_Form_Open'?????
Form is valid and everything else works up to that point.
thanx
D
Date Created: 13-Sep-2004 12:22:56 AM
'Last Updated: 13-Sep-2004 08:54:16 AM
'Created By : Dick Coleman
'Updated By : Dick Coleman
'Open a Form layout, displaying all records in the layout. Set sort order.
query.filter = ".t."
query.order = "Cus_name_last+Cus_name_spouse_1+Cus_name_spouse_2"
'Open the layout_type showing all the records that satisfy the filter
DIM Shared varP_cusform_tabbed as P
DIM layout_name as c
layout_name = "cusform_tabbed"
varP_cusform_tabbed = :Form.viewqueried(layout_name,query.filter, query.order )
'Create an XDialog dialog box to prompt for last name. ----- Progressive Lookup Code Below.... Find and pick Customer record by name...
repeat_lookup:
DIM SHARED vTypeIn as C
DIM SHARED vSelect as C
DIM SHARED varC_result as C
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
DIM vSelect_rl_def_orig as C
vSelect_rl_def_orig = "kl=c_customers,{keylist_build(\"H=.025,1:25[Last Name],2:25[Husband],3:25[Wife]\",''+recno(),left(''+Cus_name_last,25),left(''+Cus_name_spouse_1,25),left(''+Cus_name_spouse_2,25))}{Cus_name_last "= [varC-"vTypeIn]}"
DIM vSelect_rl_def as C
vSelect_rl_def = replace_parameters(vSelect_rl_def_orig,local_variables())
varC_result = ui_dlg_box("Customer_Select",""%dlg%
{region}
Enter a Last Name:| [.40vTypeIn!vTypeIn_changed];
| [%@vSelect_rl_def%.60,15vSelect];
{endregion};
{line=1,0};
{region}
"*15=ok_button_label!OK" "15=cancel_button_label!CANCEL"
{endregion};
%dlg%,""%code%
If a_dlg_button = "vTypeIn_changed" then
vSelect_rl_def = replace_parameters(vSelect_rl_def_orig,local_variables())
a_dlg_button = ""
end if
%code%)
'Now go to the customer record picked above.... display all data
'Conditional code follows. Executes only if the condition expression is True.
IF a5_eval_expression("=Var-"varC_result=\"OK\"") THEN
'Go to a specified record number in Form 'cusform_tabbed' .
DIM var_recno_target as N
var_recno_target = val(vSelect)
DIM object_name as C
object_name = ":"+"cusform_tabbed"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
varP_Object.recno_goto(var_recno_target)
end if
END IF
'Display a message box (style:'OK, Cancel Buttons', image: 'Question symbol', id: 'cusOK').
DIM SHARED cusOK_result as N
DIM SHARED cusOK_OK_Button as L
DIM SHARED cusOK_CANCEL_Button as L
cusOK_OK_Button = .F.
cusOK_CANCEL_Button = .F.
title_var = "Correct Customer?"
message_text_var = ""%text%
If Customer is correct then Press 'OK'
to continue with making appointment.
%text%
cusOK_result=ui_msg_box(title_var,message_text_var,UI_OK_CANCEL+ UI_SECOND_BUTTON_DEFAULT+ UI_QUESTION_SYMBOL)
'Test to see which button on the message box was pressed....
SELECT
CASE cusOK_result = UI_OK_SELECTED
cusOK_OK_Button= .t.
CASE cusOK_result = UI_CANCEL_SELECTED
cusOK_CANCEL_Button= .t.
END SELECT
'Conditional code follows. Executes only if the condition flag is True.
if .not. cusOK_OK_Button
goto repeat_lookup
end if
'---------------------------------------------------------------------------------------------------------------- works to here....then just stops...........
IF cusOK_OK_Button THEN
'Get 'Value' property of multiple objects in Form 'cusform_tabbed' .
DIM window_name as C
window_name = ":"+"cusform_tabbed"
DIM varP_Object as p
'Get a pointer to the specified window
varP_Object = obj(window_name)
'Check if the specified window exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The window '"+window_name+"' does not exist.",ui_stop_symbol)
else
DIM GLOBAL vcNextApptNum AS c
vcNextApptNum = varP_Object:Cus_nxt_appt_num.value
DIM GLOBAL vcOpenTx AS c
vcOpenTx = varP_Object:Cus_open_tx_number.value
DIM GLOBAL vcCusLastName AS c
vcCusLastName = varP_Object:Cus_name_last.value
DIM GLOBAL vdNextAppt AS d
vdNextAppt = varP_Object:Cus_next_appt.value
DIM GLOBAL vcCusHomePhone AS c
vcCusHomePhone = varP_Object:Cus_home_phone.value
DIM GLOBAL vcCusID AS c
vcCusID = varP_Object:Cus_id.value
ui_msg_box("",vcNextApptNum,ui_ok)
ui_msg_box("",vcOpenTx,ui_ok)
ui_msg_box("",vcCusLastName,ui_ok)
ui_msg_box("",vdNextAppt,ui_ok)
ui_msg_box("",vcCusID,ui_ok)
end if
END IF
end
'Conditional code follows. Executes only if the condition flag is True.
IF cusOK_OK_Button THEN
'Open a Form or Browse layout, displaying all, or selected records in the layout.
query.filter = ".t."
query.order = "Tx_id_number"
'===============================================================do i need to change varP_Tx_Form_Open to varP_open_tx_form???
'Open the layout_type showing just the records that satisfy the filter
DIM Shared varP_Tx_Form_Open as P
DIM layout_name as c
layout_name = "Tx_Form_Open"
' dim tempP as p
' 'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
' tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
' 'Test if pointer is valid
' if is_object(tempP) then
' 'Test if pointer refers to a form or browse
' if tempP.class() = "form" .or. tempP.class() = "browse" then
' 'Apply the query to the form or browse as the Base query. (this means that
' 'the user cannot turn the query off, only add to the query)
' tempP.BaseQueryRun(query.filter,query.order)
' 'then activate the already open window
' tempP.activate()
' else
' 'Window is not already open, so open it
' varP_Tx_Form_Open = :Form.viewqueried(layout_name,query.filter, query.order )
' end if
' else
varP_Tx_Form_Open = :Form.viewqueried(layout_name,query.filter, query.order )
' end if
END IF
'Conditional code follows. Executes only if the condition flag is True.
IF cusOK_OK_Button THEN
'Enter new record in Form 'Tx_Form_Open' at parent level.
DIM object_name as C
object_name = ":"+"Tx_Form_Open"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
varP_Object.new_record()
end if
END IF
Form is valid and everything else works up to that point.
thanx
D
Date Created: 13-Sep-2004 12:22:56 AM
'Last Updated: 13-Sep-2004 08:54:16 AM
'Created By : Dick Coleman
'Updated By : Dick Coleman
'Open a Form layout, displaying all records in the layout. Set sort order.
query.filter = ".t."
query.order = "Cus_name_last+Cus_name_spouse_1+Cus_name_spouse_2"
'Open the layout_type showing all the records that satisfy the filter
DIM Shared varP_cusform_tabbed as P
DIM layout_name as c
layout_name = "cusform_tabbed"
varP_cusform_tabbed = :Form.viewqueried(layout_name,query.filter, query.order )
'Create an XDialog dialog box to prompt for last name. ----- Progressive Lookup Code Below.... Find and pick Customer record by name...
repeat_lookup:
DIM SHARED vTypeIn as C
DIM SHARED vSelect as C
DIM SHARED varC_result as C
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
DIM vSelect_rl_def_orig as C
vSelect_rl_def_orig = "kl=c_customers,{keylist_build(\"H=.025,1:25[Last Name],2:25[Husband],3:25[Wife]\",''+recno(),left(''+Cus_name_last,25),left(''+Cus_name_spouse_1,25),left(''+Cus_name_spouse_2,25))}{Cus_name_last "= [varC-"vTypeIn]}"
DIM vSelect_rl_def as C
vSelect_rl_def = replace_parameters(vSelect_rl_def_orig,local_variables())
varC_result = ui_dlg_box("Customer_Select",""%dlg%
{region}
Enter a Last Name:| [.40vTypeIn!vTypeIn_changed];
| [%@vSelect_rl_def%.60,15vSelect];
{endregion};
{line=1,0};
{region}
"*15=ok_button_label!OK" "15=cancel_button_label!CANCEL"
{endregion};
%dlg%,""%code%
If a_dlg_button = "vTypeIn_changed" then
vSelect_rl_def = replace_parameters(vSelect_rl_def_orig,local_variables())
a_dlg_button = ""
end if
%code%)
'Now go to the customer record picked above.... display all data
'Conditional code follows. Executes only if the condition expression is True.
IF a5_eval_expression("=Var-"varC_result=\"OK\"") THEN
'Go to a specified record number in Form 'cusform_tabbed' .
DIM var_recno_target as N
var_recno_target = val(vSelect)
DIM object_name as C
object_name = ":"+"cusform_tabbed"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
varP_Object.recno_goto(var_recno_target)
end if
END IF
'Display a message box (style:'OK, Cancel Buttons', image: 'Question symbol', id: 'cusOK').
DIM SHARED cusOK_result as N
DIM SHARED cusOK_OK_Button as L
DIM SHARED cusOK_CANCEL_Button as L
cusOK_OK_Button = .F.
cusOK_CANCEL_Button = .F.
title_var = "Correct Customer?"
message_text_var = ""%text%
If Customer is correct then Press 'OK'
to continue with making appointment.
%text%
cusOK_result=ui_msg_box(title_var,message_text_var,UI_OK_CANCEL+ UI_SECOND_BUTTON_DEFAULT+ UI_QUESTION_SYMBOL)
'Test to see which button on the message box was pressed....
SELECT
CASE cusOK_result = UI_OK_SELECTED
cusOK_OK_Button= .t.
CASE cusOK_result = UI_CANCEL_SELECTED
cusOK_CANCEL_Button= .t.
END SELECT
'Conditional code follows. Executes only if the condition flag is True.
if .not. cusOK_OK_Button
goto repeat_lookup
end if
'---------------------------------------------------------------------------------------------------------------- works to here....then just stops...........
IF cusOK_OK_Button THEN
'Get 'Value' property of multiple objects in Form 'cusform_tabbed' .
DIM window_name as C
window_name = ":"+"cusform_tabbed"
DIM varP_Object as p
'Get a pointer to the specified window
varP_Object = obj(window_name)
'Check if the specified window exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The window '"+window_name+"' does not exist.",ui_stop_symbol)
else
DIM GLOBAL vcNextApptNum AS c
vcNextApptNum = varP_Object:Cus_nxt_appt_num.value
DIM GLOBAL vcOpenTx AS c
vcOpenTx = varP_Object:Cus_open_tx_number.value
DIM GLOBAL vcCusLastName AS c
vcCusLastName = varP_Object:Cus_name_last.value
DIM GLOBAL vdNextAppt AS d
vdNextAppt = varP_Object:Cus_next_appt.value
DIM GLOBAL vcCusHomePhone AS c
vcCusHomePhone = varP_Object:Cus_home_phone.value
DIM GLOBAL vcCusID AS c
vcCusID = varP_Object:Cus_id.value
ui_msg_box("",vcNextApptNum,ui_ok)
ui_msg_box("",vcOpenTx,ui_ok)
ui_msg_box("",vcCusLastName,ui_ok)
ui_msg_box("",vdNextAppt,ui_ok)
ui_msg_box("",vcCusID,ui_ok)
end if
END IF
end
'Conditional code follows. Executes only if the condition flag is True.
IF cusOK_OK_Button THEN
'Open a Form or Browse layout, displaying all, or selected records in the layout.
query.filter = ".t."
query.order = "Tx_id_number"
'===============================================================do i need to change varP_Tx_Form_Open to varP_open_tx_form???
'Open the layout_type showing just the records that satisfy the filter
DIM Shared varP_Tx_Form_Open as P
DIM layout_name as c
layout_name = "Tx_Form_Open"
' dim tempP as p
' 'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
' tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
' 'Test if pointer is valid
' if is_object(tempP) then
' 'Test if pointer refers to a form or browse
' if tempP.class() = "form" .or. tempP.class() = "browse" then
' 'Apply the query to the form or browse as the Base query. (this means that
' 'the user cannot turn the query off, only add to the query)
' tempP.BaseQueryRun(query.filter,query.order)
' 'then activate the already open window
' tempP.activate()
' else
' 'Window is not already open, so open it
' varP_Tx_Form_Open = :Form.viewqueried(layout_name,query.filter, query.order )
' end if
' else
varP_Tx_Form_Open = :Form.viewqueried(layout_name,query.filter, query.order )
' end if
END IF
'Conditional code follows. Executes only if the condition flag is True.
IF cusOK_OK_Button THEN
'Enter new record in Form 'Tx_Form_Open' at parent level.
DIM object_name as C
object_name = ":"+"Tx_Form_Open"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
varP_Object.new_record()
end if
END IF
Comment