This may be a challenge...inheritting information from a saved form via dialog choice

OKay.  I have a database where I enter in a calltrack and then save.  There would be clients who are repeated multiple times.  Currently, to inherit data, we go through views, find the client, select the calltrack, and open a new form, which inherits the data.

Is there any way, in my form, to have a button that will bring up a dialog box containing that view, or some variation of it, where if I am already in the form, I just simply hit the button and choose the client name for the information I want to inherit from already saved forms in the database?

Does this make sense?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use @PickList (function or script equivalent)

The picklist will return the column value of the selected row.


choice:=@PickList( [Custom] : [Single] ; @DbName ; "Products" ; "Select a product" ; "Please select the products you want to order" ; 2 );

Opens the products view and set choice variable to second col of the selected row.
brianbaileyAuthor Commented:
OKay...that brings in a single field (the one indicated by that "2" column).  I was hoping to bring in several fields at once:

Company Name:
Phone Number:
Email Address:

is there a way to select the call from the dialog and have it populate all 4 of these fields?
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

concat all the fields and hide it, use that column number

Concat like this in column formula

Company Name + "~" + Caller + "~" + Phone Number + "~" + Email Address

When you capture the value of the col, it will give you values delimited with ~ so break it like this

choice:=@PickList( [Custom] : [Single] ; @DbName ; "Products" ; "Select a product" ; "Please select the products you want to order" ; 2 );
Company Name := @Word( choice; "~"; 1);
Caller := @Word( choice; "~"; 2);
Phone Number := @Word( choice; "~"; 3);
Email Address := @Word( choice; "~"; 4); ""
brianbaileyAuthor Commented:


Have you forgotten me already?  As soon as you used the word "concat" you lost me.  What do you mean by concat?  I think I might be catching on to what you are saying, but I am not sure.
I meant concatenate.

If you are getting a few fields, the following code in a button can do it nicely:

      Const sourceToDestinationFieldMap = "Subject=SendTo,PostedDate=CopyTo" 'example: lookup subject, place in sendTo; then lookup postedDate, place in copyTo
      Const VIEW_NAME = "($All)"
      Dim ws As New notesUiWorkspace
      Dim form As notesUiDocument
      Set form = ws.currentDocument
      Dim db As notesDatabase
      Set db = form.document.parentDatabase
      Dim docs As notesDocumentCollection
      Set docs = ws.PickListCollection( PICKLIST_CUSTOM ,, db.server,db.filePath , VIEW_NAME , VIEW_NAME,"Pick client")
      If docs.count = 0 Then
            Print "Cancelled"
      End If
      Dim doc As notesDocument
      Set doc = docs.getFirstDocument
      Dim fieldList As Variant
      doc.sourceToDestinationFieldMap = sourceToDestinationFieldMap
      fieldList = Evaluate(|
mapList := @Explode(sourceToDestinationFieldMap; ",");
sourceFields := @Left(mapList;"=");
FIELD sourceToDestinationFieldMap := @Right(mapList; "=");
      Dim index As Integer, sourceField As String, sourceValue As String, destField As String
      For index = Lbound(fieldList) To Ubound(fieldList)
            sourceField = fieldList(index)
            sourceValue = doc.getItemValue(sourceField)(0)
            destField = doc.sourceToDestinationFieldMap(index)
            Print "Setting field " destField " to " sourceValue " (from source field " sourceField ")"
            form.fieldSetText  destField , sourceValue
brianbaileyAuthor Commented:
Oh my.

NOVICE!!! NOVICE!!!  *points to self*


That seems a bit too complicated for me, but would be great as a button.  However, just looking to do it as the initial creation popup dialog right now.


I did what you said and nothing errored, but nothing populated either.  Does it matter what field i place the following in:

choice:=@PickList( [Custom] : [Single] ; @DbName ; "0.0 Caller Index" ; "Select Data to Inherit" ; "Please select Client Data to Inherit" ; 6 );
CLIENT:= @Word( choice; "~"; 1);
NAME:= @Word( choice; "~"; 2);
PHONE:= @Word( choice; "~"; 3);
eMail:= @Word( choice; "~"; 4); ""

The 6th column of "0.0 Caller Index" contains the following:

CLIENT + "~" + NAME + "~" + PHONE + "~" + EMAIL

Hey, a novice shoudl be able to use that code as-is, with thefollowing setup issues:

1) create the button
2) change it from FORMUAL to LOTUSSCRIPT
3) Paste the code in between the Sub Click / End SUb that appears
4) Change the two lines at the top, using appropriate values (CONST VIEW_NAME and CONST sourceToDestinationFieldMap)

brianbaileyAuthor Commented:
I was fine until step 4...what would I want to indicate if:

NAME maps to NAME

Also, would it be ?:
 Const VIEW_NAME = "0.0 Caller Index"

Well you have to set it to field rather than variable.. here is the formula

choice:=@PickList( [Custom] : [Single] ; @DbName ; "0.0 Caller Index" ; "Select Data to Inherit" ; "Please select Client Data to Inherit" ; 6 );
FIELD CLIENT:= @Word( choice; "~"; 1);
FIELD NAME:= @Word( choice; "~"; 2);
FIELD PHONE:= @Word( choice; "~"; 3);
FIELD eMail:= @Word( choice; "~"; 4);

brianbaileyAuthor Commented:
It worked for phone and email, but not Client or Name (put the formula in the Client field).  I must be missing something.
Probably data is null.

Just prompt out and see what is the value you are getting back from view

@Prompt([ok]; ""; Choice) after picklist call

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brianbaileyAuthor Commented:
It shows all 4, in the correct order.  The only thing that it might have a problem with is that Client and Name are more than one word each (ie. Jane Smith~Example
> NAME maps to NAME
> etc.

> Also, would it be ?:
>  Const VIEW_NAME = "0.0 Caller Index"

     Const sourceToDestinationFieldMap = "Client=Client,Name=Name"
     Const VIEW_NAME = "0.0 Caller index"

Please note: good programming practices in Notes call for NOT using user-visible views for looking things up progarmmatically, ecause who knows what the user might request that you change in "their" views later?  Another good practice is to use the view comment to identify where you have used the view progarmmatically, so that if someone decides that a lookup to it requires revision, you can figure out if there will be any side-effects to the change.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.