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


Default Value formula problem

Posted on 2003-12-05
Medium Priority
Last Modified: 2013-12-18
Hello all.  I have been banging my head over this problem and cannot seem to get it to work.

I have a field "txtSubmittedBy" that is an editable dialog that uses the address dialog list for choices.  It has a default value based on the user and has some exiting script that updates the uses phone number when changed.

My problem is that I want to have a default value of the user who creates the document in the txtSubmittedBy field.  I achieved this successfully by putting @Name([CN];@UserName in the default value of the field.  My problem is that when some else opens the document to view, the default value was changing to their name and replacing the original.  We want this field to be a dialog list because uses may need to change that field manually.

I tried to circumvent the default value by placing this formula in the default value:


However, all this does is return the "Unknown" string value when it is reopened for editing.  

Is there any way to get the original value to stay in the field until the user manually changes it?

Thanks in advance all.
Question by:Pucktarget
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
  • 2
  • +3
LVL 31

Expert Comment

ID: 9884092
YOu must be doing something really weird. Default formula only runs when the field doesn't already have a value.  That would be true if the document is first being composed, or if you added the field to a form later (in which case, even though the document exists, the field did not previously exist, and the deafult value runs.

It appears to ne that you may have uysed a COMPUTED field with this formula, and set up a button that displays the address dialog, and forces the field value to change.  What you probably want to do is make the field COMPUTED WHEM COMPOSED, so that the formula acts as only a default.  COMPUTED WHEN COMPOSED fields essentially have DEFAULT formula, but are not editable.  Regular computed fields have a formula that applies both as a default and as an update ("translation")

Author Comment

ID: 9884165
The field does exist on open of the form and pops up with that user in it.  You are right, this is weird, it would be really easy if they did not want to be able to reselect a user for the field.  Another confusing thing is that we are using that field to generate an informational "phone number" field, so we have script that runs on exit of the field to truncate the field and find the new phone number.

Would the dialog list be generating a null value somehow?  That is why when it reopens the document the field value disappears?
LVL 31

Expert Comment

ID: 9884346
Null strings are still considered "values" and will not cause DEFAULT to run again.  If you use @UnAvailable or @DeleteField, that will cause the field to be eliminated completely, and DEFAULT would run again.

I need to understand your structure better.  Please confirm:

Main form -- has a field named txtSubmittedBy.  Definition:
* EDITABLE (not computed/computed for display/computed for compoased)
* Type is DialogList
* Dialog list definition (third tab) specifies "uses Address Dialog for choices"
* Has a DEFAULT formula of @If(@IsNewDoc;@Name([CN];@UserName);txtSubmittedBy!="";txtSubmittedBy;"Unknown")
* Has NO translation formula

There is no subform involved, or other form that s used via @DialogBox.  The dialog box is opened because Notes simply does that for DialogList fields with "Address dialog for choices."

There is no other formula on the form that references txtSubmittedBy

There is no LotusScript on the form

Can you confirm all of the above?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 24

Expert Comment

ID: 9884464
You pointed out that

>has some exiting script that updates the uses phone number

So could be that some other script in querysave or recalc event is destroying the field value. Similarly translation is not removing the content..

Quickly check the doc properties in the view that what this field holds when it is saved


Author Comment

ID: 9884488
Here is what I can confirm for you..thanks for the help btw.

Field: txtSubmittedBy

Type: Dialog List and is Editable

Dialog Control: "Uses Address Dialog for choices" and the options selected are: Display entry helper button and Refresh fields on keyword change.

There is no input transalation formula.

There is LotusScript on exit of the field which truncates the Notes name:

Sub Exiting(Source As Field)
      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim intCount As Integer
      Dim strRequester As String
      Set uidoc = workspace.CurrentDocument
      Call uidoc.Refresh
      If intCount>0 Then
            Call uidoc.FieldSetText("txtSubmittedBy",strRequester)
      End If
      Call uidoc.refresh
End Sub

There is also some LotusScript on a submit button, which submits the form and sends out a link to certain indiviuals.

LVL 31

Accepted Solution

qwaletee earned 600 total points
ID: 9884574
OK, one test.  Create a new test document with the form.  Change the field value to some test name via the address dialog, or just via text entry.  Save it, and exit.

Open the test document again.  From what you wrote above, it will change the field value from the test name you enetered into either Unknown or your name, depending on which verson of the formula you are using.

Is that the case?

Author Comment

ID: 9884895
I created the test doc with just 2 fields.  I changed the doc via the dialog list, saved it and exited.

When I reopened the form it was back to my name.  

I don't know if it makes a difference but we are using a submit button to post the document to a view once completed, so each saved document appears as a different record.

LVL 46

Expert Comment

by:Sjef Bosman
ID: 9888281
After you save the document, look in the Document Properties. What's the value of txtSubmittedTo? Correct or Wrong, so you know whether it happens while closing or reopening.

Expert Comment

ID: 9891383
First question:
<quote>Is there any way to get the original value to stay in the field until the user manually changes it?</quote>

meaning if its a new doc, get the current user, else get the saved user.

if you want to also keep track of who's been using the doc, then I would place a seperate field, say user_List, and append the current user to it.
@if(@IsNewDoc;@Name([CN];@UserName);txtSubmittedBy+","+@Name([CN];@UserName))(don't hold me to this one, i'm a ls kinda guy)
Then you can show the values as a combobox selected by formula(second tab) fieldname(user_List), make sure sorting is off.
Not exactly what you want I know.

Expert Comment

ID: 9895784
Try my baby in a normal text field :-)

@If(@IsNewDoc;@Text(@Name([CN];@UserName))+ " at " + @Text(@now);@ThisValue+","+@Text(@Name([CN];@UserName)) + " at " +@Text(@Now));
rem {@If(@IsDocBeingSaved;@Name([CN]; @UserName);modifier)};
LVL 24

Expert Comment

ID: 9896771

"I don't know if it makes a difference but we are using a submit button to post the document to a view once completed, so each saved document appears as a different record."

DOes that mean that you might be dropping of this field while posting it as a different record ?


Author Comment

ID: 9898882
Hi Qwaltee, (and thanks to other Experts as well for your comments).

Your test had me thinking about how the document was being saved.  I was saving it correctly and the field was properly holding its default value and is did not change as you pointed out.

However, my problem is in that I was trying to send a link to the newly submitted document when the user hits a submit button on the form.  The button saved the doc but then sent a link to a new blank document.  Your comments about the default value and to make a dummy form and test steered me in the right direction.

I will post a follow up question regarding sending a link after closing a form via NotesUIDocument class (if it is possible).

Thanks for your help.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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