EmplOyEE LooKuP

Tuesday, March 18, 2008




Code use in button. User info will be extracted from another database named User Profile.

path := G_Server : UserLoc;
view := "LsvEmpLookup";

list := @DbColumn(""; path; view; 1);
EmpKey := @Text(@Prompt([OkCancelList]; "Name"; "Select employee name."; ""; list));
@If (@Member(EmpKey; list) = @False; @Return(""); @True);

@SetField("PreName"; @Unique(@Trim(EmpKey)));

EmpInfo := @DbLookup("" : "NoCache"; path ; View; EmpKey; 2);
@If(@IsError(EmpInfo); @Do(@Prompt([Ok]; "Error"; "Details of employee cannot be extracted from the database."); @Return("")); @Success);

tmpManager := @Subset(@Word(EmpInfo; "|"; 3);1);
hEmpManager := @If(@Contains(tmpManager; ":");@Right(tmpManager; ":"); tmpManager);

b := @Word(EmpInfo; "|"; 2);
c := @Word(EmpInfo; "|"; 3);
d := @Word(EmpInfo; "|"; 24);
e := @Word(EmpInfo; "|"; 6);
f := @Word(EmpInfo; "|"; 11);

@SetField("Emp"; @Unique(@Trim(EmpKey)));
@SetField("Emp_num"; @Unique(@Trim(b)));
@SetField ("Manager"; hEmpManager);
@SetField("Dept"; @Unique(@Trim(d)));
@SetField("Div"; @Unique(@Trim(e)));
@SetField("Comp"; @Unique(@Trim(f)))

0 comments: