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

Posted on 2003-12-01
Last Modified: 2013-12-18
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?
Question by:brianbailey
  • 6
  • 6
  • 3
LVL 24

Expert Comment

ID: 9852309
Use @PickList (function or script equivalent)

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

LVL 24

Expert Comment

ID: 9852317

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.

Author Comment

ID: 9852519
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?
LVL 24

Expert Comment

ID: 9852588
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); ""

Author Comment

ID: 9852644


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.
LVL 24

Expert Comment

ID: 9852719
I meant concatenate.

LVL 31

Expert Comment

ID: 9852901
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 9852961
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

LVL 31

Expert Comment

ID: 9853045
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)


Author Comment

ID: 9853159
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"

LVL 24

Expert Comment

ID: 9853195
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);


Author Comment

ID: 9853359
It worked for phone and email, but not Client or Name (put the formula in the Client field).  I must be missing something.
LVL 24

Accepted Solution

HemanthaKumar earned 63 total points
ID: 9853467
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

Author Comment

ID: 9853524
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
LVL 31

Assisted Solution

qwaletee earned 62 total points
ID: 9854525
> 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.

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.5 1 137
Lotus notes view not working using Trim 14 205
External emails not coming through 3 96
Domino Server 11 62
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now