Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Button with address book behind to populate fields

Posted on 2002-03-27
7
Medium Priority
?
239 Views
Last Modified: 2013-12-18
In a database I am creating, there is to be a 'requested by' button.  Behind the button I would like to have code that brings up an address book choice box, you pick the name of the caller from the address book <NAB> and the fields branch/phone etc are populated from that.  There is a similar database in use on one of our servers <designed by someone no longer here> that has that type of button that works on that server only <though the form is used company wide>.  The code behind the existing button is...

SubDir:=@LeftBack(@Subset(@DbName;-1);"\\");
DB_Name:=@If(SubDir="";"";SubDir+"\\") + ContactList;
Choice:=@PickList([Custom];@Subset(@DbName;1):DB_Name; "Employees";"Select A Contact";"Select the related contact.";1);
Chosen_Contact:=@Subset(Choice;1);
@If(Chosen_Contact ="";"";@Do(
@SetField("RelatedDocument"; @Text(Chosen_Contact));
@SetField("RequestedBy";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;2));
@SetField("PeopleToNotify";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;2));
@SetField("ReqByPhone";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;3));
@SetField("ReqByLocal";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;4));
@SetField("ReqByDept";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;5));
@SetField("ReqByDivision";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;6));
@SetField("ReqByBranch";@DbLookup("":"NoCache"; @Subset(@DbName;1):DB_Name; "Employees"; Chosen_Contact;7))))

Is this more complicated code than I need put in?

Any suggestions?

thanks
0
Comment
Question by:Paulette
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6901285
The code,
SubDir:=@LeftBack(@Subset(@DbName;-1);"\\");
DB_Name:=@If(SubDir="";"";SubDir+"\\") + ContactList;

is the deciding factor to see what database it is hitting.

In the line,
Choice:=@PickList([Custom];@Subset(@DbName;1):DB_Name; "Employees";"Select A Contact";"Select the related contact.";1);

@Subset(@DbName;1), select the server which would be the current server the database is residing.

In order to generalize this code, do this (Which will be a hard coding)

Server := "Name of the server where the lookup db is residing";
DB_Name := "Path to the database"


OR you can use some kind of control document and store centrally the path and server info of the lookup database, OR you can create a shared field containting the same info.

Let me know which suits your purpose

~Hemanth
0
 

Author Comment

by:Paulette
ID: 6903277
As the database will be on 3 or 4 servers, geographically distant, what would you suggest to be the 'best' or 'most straight-forward' way to accomplish what I am aiming to do?

any suggestions appreciated
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6904885
Replicate the database which will be used for lookup to all 3 or 4 servers and use the replicaID in place of Server:DBPath for lookup.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Paulette
ID: 6910554
Would it be more straight-forward for me to create my own code or method to achieve this lookup?  Rather than trying to pick someone elses code apart and change as necessary, would I maybe be further ahead <given I am at the beginner level of design> to use a method other than this?

Or maybe I am trying to do something WAY over my head....

thanks for your input as usual.....looking forward to your opinion...
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 800 total points
ID: 6910765
The above method is not that bad, except for numerous dblookups which really kills the system. One simple approach would be to create an hidden column in the view where the picklist is acting and extract the selected values for selected row


You have to design an extra column in employees (I have refered that column as 10) like this,

RelatedDocument + "~" + RequestedBy + "~"...So..on...


Here is the formula
-==================
RepID := "852564A0:006B7872";
Choice:=@PickList([Custom];RepID; "Employees";"Select A Contact";"Select the related
contact.";10);
REM " The extracted value 'Choice' contains the string in format, RelatedDocument~RequestedBy~...";

@if(choice = ""; @Return(0); @True);

FIELD RelatedDocument := @Word(choice;"~"; 1);
FIELD RequestedBy := @Word(choice;"~"; 2);
FIELD PeopleToNotify := @Word(choice;"~"; 3);
FIELD ReqByPhone := @Word(choice;"~"; 4);
FIELD ReqByLocal := @Word(choice;"~"; 5);
FIELD ReqByDept := @Word(choice;"~"; 6);
FIELD ReqByDivision := @Word(choice;"~"; 7);
FIELD ReqByBranch := @Word(choice;"~"; 8);
@True

============

PS: you can replace RepID := "852564A0:006B7872"; with appropriate replica id of the database used for lookup. Either you can hardcode or put it in some profile or control doc and refer it.





0
 

Author Comment

by:Paulette
ID: 6911063
When I click on the 'requested by' button I get this error

'entry not in design list'  <pretty unspecific I know....>

what causes this?  
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6911548
The specified column 10 is  hypothetical, you have to substitute with the column that contains all the information that will be retrieved and parsed.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question