Hi,
I have a login script code below, and I would like to add a customer lookup and populate the script field from the lookup. No matter what I try, I cannot seem to get a lookup to work from the script;
Here's the script I'm Running:
__________________________________________________________
'Date Created: 28-Sep-2007 06:37:15 PM
'Last Updated: 13-Jan-2009 07:26:29 PM
'Created By : Tom
'Updated By : Ryland
'Create an XDialog dialog box to prompt for parameters.
DIM global_var_A as c
DIM GLOBAL user as C
DIM GLOBAL pword as C
DIM GLOBAL level as C
DIM GLOBAL varC_result as C
dim global try as n
dim global way as c
dim ans as n
dim time_in as c
dim tbl as p
dim qry as p
dim recs as n
dim qry_1 as p
dim recs_1 as n
dim global user_level as c
DIM global v_personnel as c
dim XDialogStyle as p
user=""
pword=""
level=""
user_level=""
v_personnel=""
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
Delete XdialogStyle
XDialogStyle.AccentColor = "White"
XDialogStyle.Color = "#51+102+255"
varC_result = ui_dlg_box("User Log In",<<%dlg%
{Windowstyle=Gradient Radial Bottom Right}
{region}
Enter User Name:| [.30user];
Enter Password:| [%p%.30pword];
{endregion};
{line=1,0};
{region}
{justify=center}
<15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%)
user=upper(user)
pword=upper(pword)
tbl=table.open("customer")
tbl_1=table.open("invoice_header")
query.filter="customer_id = "+s_quote(user)
query.order=""
query.options="T"
qry=tbl.query_create()
recs=qry.records_get()
'Begin Here
query.filter="customer_id = "+s_quote(user)
query.order=""
query.options="T"
qry_1=tbl_1.query_create()
recs_1=qry.records_get()
'end here
if regex_match(user,"\b[A-Z0-9a-z._%-]+@[A-Z0-9a-z._%-]+\.[A-Za-z]{2,4}\b")= .F.
msgbox("Invalid email Format - Please Re-enter")
script_play("Main_Menu")
end
end if
if user <> tbl.customer_id then
msgbox("User ID not Found - Please Re-enter")
script_play("Main_Menu")
end
end if
if pword <> tbl.Psword then
msgbox("Password Does Not Match - Please Re-enter")
script_play("Main_Menu")
end
end if
if varC_result="CANCEL" then
user="Cancelled-No user logged in"
script_play("Main_Menu")
end
end if
if recs_1 = 1 .and. (tbl.level = "customer" .or. tbl.level = "temporary" ) .and. tbl_1.Cc_number = ""
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("Tool_Issue_Verify")
msgbox("Tool Issue Outstanding - Please Scan to Check-In or Have Custodian Override")
end
end if
if recs_1 = 1 .and. (tbl.level = "customer" .or. tbl.level = "temporary" ) .and. tbl_1.Cc_number <> ""
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("invoice_menu")
end
end if
if recs = 1 .and. pword=tbl.Psword .and.(tbl.level = "Supervisor" .or. tbl.level = "Commander" .or. tbl.level = "Custodian")
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("Tracs_Menu")
end
end if
______________________________________________________________
Thanks, Ryland
I have a login script code below, and I would like to add a customer lookup and populate the script field from the lookup. No matter what I try, I cannot seem to get a lookup to work from the script;
Here's the script I'm Running:
__________________________________________________________
'Date Created: 28-Sep-2007 06:37:15 PM
'Last Updated: 13-Jan-2009 07:26:29 PM
'Created By : Tom
'Updated By : Ryland
'Create an XDialog dialog box to prompt for parameters.
DIM global_var_A as c
DIM GLOBAL user as C
DIM GLOBAL pword as C
DIM GLOBAL level as C
DIM GLOBAL varC_result as C
dim global try as n
dim global way as c
dim ans as n
dim time_in as c
dim tbl as p
dim qry as p
dim recs as n
dim qry_1 as p
dim recs_1 as n
dim global user_level as c
DIM global v_personnel as c
dim XDialogStyle as p
user=""
pword=""
level=""
user_level=""
v_personnel=""
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
Delete XdialogStyle
XDialogStyle.AccentColor = "White"
XDialogStyle.Color = "#51+102+255"
varC_result = ui_dlg_box("User Log In",<<%dlg%
{Windowstyle=Gradient Radial Bottom Right}
{region}
Enter User Name:| [.30user];
Enter Password:| [%p%.30pword];
{endregion};
{line=1,0};
{region}
{justify=center}
<15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%)
user=upper(user)
pword=upper(pword)
tbl=table.open("customer")
tbl_1=table.open("invoice_header")
query.filter="customer_id = "+s_quote(user)
query.order=""
query.options="T"
qry=tbl.query_create()
recs=qry.records_get()
'Begin Here
query.filter="customer_id = "+s_quote(user)
query.order=""
query.options="T"
qry_1=tbl_1.query_create()
recs_1=qry.records_get()
'end here
if regex_match(user,"\b[A-Z0-9a-z._%-]+@[A-Z0-9a-z._%-]+\.[A-Za-z]{2,4}\b")= .F.
msgbox("Invalid email Format - Please Re-enter")
script_play("Main_Menu")
end
end if
if user <> tbl.customer_id then
msgbox("User ID not Found - Please Re-enter")
script_play("Main_Menu")
end
end if
if pword <> tbl.Psword then
msgbox("Password Does Not Match - Please Re-enter")
script_play("Main_Menu")
end
end if
if varC_result="CANCEL" then
user="Cancelled-No user logged in"
script_play("Main_Menu")
end
end if
if recs_1 = 1 .and. (tbl.level = "customer" .or. tbl.level = "temporary" ) .and. tbl_1.Cc_number = ""
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("Tool_Issue_Verify")
msgbox("Tool Issue Outstanding - Please Scan to Check-In or Have Custodian Override")
end
end if
if recs_1 = 1 .and. (tbl.level = "customer" .or. tbl.level = "temporary" ) .and. tbl_1.Cc_number <> ""
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("invoice_menu")
end
end if
if recs = 1 .and. pword=tbl.Psword .and.(tbl.level = "Supervisor" .or. tbl.level = "Commander" .or. tbl.level = "Custodian")
v_personnel= tbl.customer_id
user_level = tbl.Level
script_play("Tracs_Menu")
end
end if
______________________________________________________________
Thanks, Ryland