How to sometimes inherit field values?

This one should be easy but has me stumped… In a Notes app, I want to create a new document which inherits field values from a previous document. But sometimes, users want to create a new document that does NOT inherit.

The problem is that if I set the form to inherit (and put in the default field values) then the form will always inherit, it seems to me. I want the user to be able to create a clean new doc, even if the view has a previous document highlighted.

I have considered the following:

  • I could make two forms, identical except that one inherits. But that is duplicating lots of code.

  • I could make a button that says “Delete previous fields this form just inherited”. But that means I have to maintain a separate list of inherited fields, in the button.

  • I could make a dummy document which is empty. When the user wants to create a clean new doc, they highlight the dummy one before creating the new. But that is really awkward and unnatural for the user.

What I want is some way to say “compose a doc AND inherit field values” and also “compose a doc and DON’T inherit fields”. Both with the same form.

TIA,

Chuck Connell

http://www.chc-3.com

Subject: How to sometimes inherit field values ?

Make a button which says “New Document” and another which says “New Document with Inheritance” (or whatever makes sense. Set an environment variable indicating which you want, then have the default formulas for the fields to inherit say

@If(@Environment(“MyVar”)=“Inherit”; FieldName; “”)

since inheritance depends on evaluation of the default formula.

Subject: Use a subform

Copy all your fields to a subform. Create two forms, one that inherits and one that doesn’t. Include the subform on both forms.

Subject: How to sometimes inherit field values ?

Why not just make a “New Document” button and when they click on it, have a prompt ask if they want to inherit the field values, if they answer no, just clear the fields.

MJ

Subject: How to sometimes inherit field values ?

Chuck, first thing that comes to mind is that if you were to go the ‘Delete inherited fields’ button route, since the new doc is opened in the UI, could you just set up a loop that uses uidoc.GotoNextField and, for each field, clear it with uidoc.FieldSetText(“”, “”). You would need to know how many fields are on the form to use in the For loop.