[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Selected fields inheriting values from selected document

Posted on 2006-05-07
16
Medium Priority
?
455 Views
Last Modified: 2013-12-18


Morning all,

I've a form with the option 'Formulas inherit values from selected document' selected.  The form has several fields which are computed to themselves and they pull in the values from the selected document.  However I only want a few of the fields on the form to pull in values from the selected document not all of them the rest should just be blank as they get computed when the user starts to fill in other information.

I don't think I've explained that very well.
Thanks,
Richard
0
Comment
Question by:RichardStarkey
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 22

Accepted Solution

by:
mbonaci earned 172 total points
ID: 16629710
Hi RichardStarkey,
keep formulas the same, but clear the ones you don't want transfered in PostOpen form event, like this:

    If source.IsNewDoc Then
        Call source.document.ReplaceItemValue( "fldName", "" )
    End If

Hope this helps,
Marko
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 164 total points
ID: 16631413
Or change the formulas in the fields to

@If(@IsNewDoc;"";FieldName);
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16631433
or maybe (not sure if this works on inheriting values, it does for setting initial value of computed field)

DEFAULT FieldName:="";
FieldName;

Steve
0
Technology Partners: 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:RichardStarkey
ID: 16644565

The post open event works best I think.  It looks like using @IsNewDoc means that I cannot then go on to set the values of the fields in the new document.

One quick question, how can I refresh the document once I have reset the values in the post open event?  I tried call source.document.refresh but it generates an error
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16653311
True about the @IsNewDoc bit, depends if you need those fields to be updated while the doc. is still new.  You could try @IsDocBeingLoaded
source.refresh should do for the refresh as you are refreshing the notesUIdocument not notesdocument

Steve
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16676183
Hi RichardStarkey,
Ok, maybe I'm missing something here.  When I want a form to inherit values, I have to put the fieldname that I want to inherit in the field that should inherit in on the new form.  If I leave the field blank, then it doesn't inherit the value.

So, let's say I have a form A:
Name
Address
Phone

Task at Hand
Date of Task

Form B, when opened should inherit name, address and phone into these different (or same field names)

User: (default value: Name)
Location: (default value: Address)
Contact Phone: (default value: Phone)

Inventory Assigned:
Name of Item:
Date Assigned:

So, I can inherit to totally different fields, and then decide if I want to populate other fields with these values, I can inherit "computed when composed"
and any number of variations.

Regards!
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16676994
Marilyng, I got the impression he already had computed field with the same name as the source doc. which had themselves as the value, I.e. set elsewhere using code.

Source doc.   FieldA is Fred
        FieldB is Bloggs
New doc.   FieldA is computed as FieldA
      FieldB is computed as FieldB

Wants FieldA blank and Field as source doc.

Steve
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16677504
Yes, he probably wants to inherit to the same form (the selected doc on view is created with the same form as the doc being created) and you cannot left the computed field's value blank.

So the best thing is to go with PostOpen, althougt @IsDocBeingLoaded would save the dragon's solution, I think.

Hope this helps,
Marko
0
 
LVL 18

Assisted Solution

by:marilyng
marilyng earned 164 total points
ID: 16677650
Here's my question..
>> form has several fields which are computed to themselves <<
>>rest should just be blank as they get computed when the user starts to fill in other information<<

So if I have three fields:  FirstName, LastName, FullName computed= firstname+lastName

Firstname default value =(itself) firstname,
Lastname default value= (iteself) lastname,
Fullname, computed:  firstname + lastname

Fullname is either a formula like: firstname + lastname, or itself: fullname.  
 
   You make the field equal to itself when you want to inherit values in new documents,
   You make it "" in computed-when-composed fields if you eventually want to push a value to it but want it to start empty,   and
   You don't enter a default value or formula if you want it to be blank and not inherit a value from a selected document with inheritance turned on.

So, here's a really old school method, make the field computed-when-composed and default is "".  When you fill in other fields or at the bottom of you form you can push a value to the field in another field's validation, or you can do the formula in the querysave, calc, etc.

QuerySave, QueryRecalc or PostRecalc
@SetField("Fullname";FirstName + " " + Lastname)

Do you understand?

0
 
LVL 18

Expert Comment

by:marilyng
ID: 16677723
So, in short, those that he doesn't want to inherit, should have blank formulas, instead of themselves as the formula. :)
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16678587
Hmm, you can do it that way then, never thought of doing that in many years of coding for Notes, haven't needed to use form inheritance since R3 mind... doh.

With computed when composed of *course* it doesn't re-calculate after initial compose so it's value can be set programatically without resetting without needing it's own fieldname as value.

Added to somewhere in the back of my brain for when required :-)

Steve
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16678861
Yeah, you young folks don't feel like you're programming unless it has a hunred lines of script and appears in the events modules.. :)
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16679093
Nah, 90% of my stuff is still formula in the three original field events though with LS and JavaScript when needed, sadly most customers are R5 or even R4 still :-(  Youngster?  Been programming Notes for ~11 yrs? since R3.0... quite a bit at the moment but not normally every day, bog standard Windows consultancy pays most of the bills... not much time to answer Q's around the Notes TA, mainly elsewhere but like to dip in when I can.

Steve
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16710576
So how are we doing here, Richard?  Any luck?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

865 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