Solved

Need a trick to change field selection values

Posted on 2004-10-26
587 Views
Last Modified: 2013-12-18
Hi All,

In a form, there is a field called Options: Checkbox, editable, formula for choices is AllOptions, and both Refresh fields and Refresh chocies are selected. The formula in the CfD-field AllOptions is
     @If(Options="Ma"; "Send as mail | Ma":"Send on Save | Sd"; "Send as mail | Ma")

What I want is that, if the user selects the Send as Mail option,  a second option is displayed, namely Send on Save. This works... almost, I only have to press F9 to make it show up.

Calling Refresh from the PostRecalc is illegal, but would be the solution if it weren't recursive. I already tried to put a GoToField("nextfield") in the Entering of the Options-field, but this effectively blocks the user from doing anything in that field. Which is by all means a great feature, but not for this purpose (equivalent to using InputEnabled, but works in R5 as well :).

How can I do this using more or less standard stuff? I think I know some ways around this, but your tricks are welcome!

Sjef
0
Question by:Sjef Bosman
    23 Comments
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    I found, on the 3rd tab of the Field Properties box:
       Special Notes Client Event Options, Run Exiting/OnChange events after value change

    1) Would this be a solution?
    2) Does it exist in R5 (for compatibility reasons)?
    0
     
    LVL 14

    Assisted Solution

    by:p_partha
    Did you enable "AUtomatically refresh fields" at the form level?...

    Partha
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    Hi Bro, as a matter of fact, I thought about writing that I didn't use that option, since I suppose it wouldn't make a difference since 1) it's not a refresh field that needs to be done, but a refresh choices, and 2) the refresh fields is already triggered because it is set on the field itself. I'll try tomorrow.

    Thanks for thinking along, but I'm off, to a refreshment and some peanuts. And bed afterwards. All letters start to look identical, and I seemn to be unble to  fins the keyus on myu keibord. See ya! ;)
    0
     
    LVL 15

    Expert Comment

    by:Bozzie4
    " Run Exiting/OnChange events after value change" is R6 only.  I don't know if it has an equivalent in R5 (or maybe it's even standard in R5?)

    What you could do is store the values not in the field itself, but in a separate field.  Now put code in the QueryRecalc to update this field BEFORE it will use this field's values to update the checkbox (is that clear ?)
    When refreshing, (I hope that) first the field with the values will be updated thru the QueryRecalc event, and then the checkbox will be updated with this field's values ....

    cheers,

    Tom
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    Using QueryRecalc would be one of the ways around the problem, but it is "New with R6" says the Help db. So I had already skipped it. The hard part is that a PostRecalc is too late, since field choices are refreshed before that when the field with the choices still has the old values. An additional Refresh would do, but how to trigger it? Preferably without my favourite object (a NotesTimer, indeed!).

    Must be a hard nut to cra(c)k this one...


    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    What about the "Old Fashioned Way"?

    -- an Options1 field, editable checkbox, with only one choice <<Send as mail | Ma>> and Refresh fields on keyword change
    -- an Options2 field, editable checkbox, with only one choice <<Send on Save | Sd>>  and Refresh fields on keyword change, and Hide when <<Options1 != "Ma">>
    -- an Option field, computed, with formula <<@Trim( @If( Options1 = "Ma"; Options1:Options2; Oprions1 ) )>>

    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    You can make the two formulas relative (better) if Hide when is <<Options1 = "">> and Options is <<@Trim( @If( Options1 != ""; Options1:Options2; Oprions1 ) )>>
    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    oops, a typo, this one is OK <<@Trim( @If( Options1 = "Ma"; Options1:Options2; Options1 ) )>>
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    I seem to remember vaguely that I myself sugegsted something like this not so very long ago. Without the typo's...

    It is indeed a possibility, and probably the only left that can be called "more or less standard". That there are additional fields is not a huge problem, but an important disadvantage is that I get into trouble when I have the field(s) displayed with the choices in 2 columns or when there are more choices than the two I used for the example. So I will have to place the fields on separate lines (which is also required to make hide-when work, unless I place them in separate table-cells.

    Best suggestion so far :)
    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    well, the sentence <<Old Fashioned Way>> was clearly a citation from sjef_bosman's contribs to this site ;-)
    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    the solution I gave above can be extended easily to multiple groups of options, as follows

    -- Options1: checkbox editable, Refresh fields, Allow synonyms, Enter choices
    option 1 | opt1
    option 2 | opt2
    option 3 | opt3
    option 4 | opt4

    -- Options2: checkbox editable, Refresh fields, Allow synonyms, Refresh choices, Use formula
    opt1 := "option 1.1 | opt11":"option 1.2 | opt12":"option 1.3 | opt13";
    opt2 := "option 2.1 | opt21";
    opt3 := "option 3.1 | opt31":"option 3.2 | opt32";
    opt4 := "";

    @Trim(
     @If( @Contains( Options1; "opt1" ); opt1; "" )
     : @If( @Contains( Options1; "opt2" ); opt2; "" )
     : @If( @Contains( Options1; "opt3" ); opt3; "" )
     : @If( @Contains( Options1; "opt4" ); opt4; "" )
    )

    -- Options: Text computed, Allow multiple
    @Trim( Options1 : Options2 )

    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    a little better, if we extract the Options2 formula for choices in a new AllOptions2 multivalue, always hidden, CFD field, then we can have the following "hide when" formula for Options2 that works fine: <<Options1 = "" | AllOptions2 = "">>
    0
     
    LVL 15

    Assisted Solution

    by:Bozzie4
    Darn... I though I had it with the QueryRecalc :-)

    Back to old-school antique notes programming :-)
    0
     
    LVL 31

    Expert Comment

    by:qwaletee
    If AllOptions is above Options, it will work.  That's the reaosn you needed the extra refresh.

    Want to prove it?

    Create -> Design -> Form

    Create -> Field

    Name it AllOptions, computed for display, allow multiple values, formula      @If(Options="Ma"; "Send as mail | Ma":"Send on Save | Sd"; "Send as mail | Ma")

    Press Control-End

    Press Enter

    Create -> Field

    Name it Options, Checkbox, Refresh on keyword change, Refresh choice on doc refresh, Formula for choices -- AllOptions

    Design -> Preview in Notes

    Works like a charm.
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    But... That's how it is in the form! I'll check again, don't worry. Maybe I'll create a test form, to try it out. Could it be that the order of creation is important?
    0
     
    LVL 31

    Expert Comment

    by:qwaletee
    Order of creation should be irrelevant.
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    Apparently the choices are refreshed BEFORE the form is refreshed. Makes sense, for the content of the field might have to be adapted to the choices that are allowed. Anyway, it doesn't work as described above :(

    I even had the Choices-formula in the Options field itself, didn't work.

    YOU AIN'T GONNA BELIEVE THIS! :-)

    I cracked it, but don't tell me please that you knew all along! The solution is absolutely mind-boggling: I added a simple formula in the Input Translation of the Options field, namely... Options. I reckoned: Options had its old value when the AllOptions field was re-evaluated, so I had to force to compute Options before that. I assumed the Translation formula could just be doing that, and BINGO!
    0
     
    LVL 3

    Expert Comment

    by:Andrea Ercolino
    BRAVO
    0
     
    LVL 31

    Assisted Solution

    by:qwaletee
    Sjef,

    I did not need to do the Translation Formula bit in my minimalist test.  On 5.0.11, everything worked like a charm exactly as I described it.

    What version are you using?
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    6.0.3

    I didn't create a new form and field yet, I'm just too happy that it works now. Well, let's test it rightaway...
    Nope, doesn't work, the CfD field has the correct values, but the checkbox doesn't have all the choices. If I change the Translation formula... Like Magic!!

    I wouldn't  know if this behaviour is corrected in 6.0.later or 6.5.something. Maybe someone else can test this? Tom??
    0
     
    LVL 3

    Accepted Solution

    by:
    I tested it on 6.5.1 and it didn't work as described by qwaletee
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    Thanks RAPUTA. So we have a new Notes "feature" indeed, to be added to the long list!  Yeaaah! :)

    Any news on 6.0.4 or 6.5.latest?
    0
     
    LVL 46

    Author Comment

    by:Sjef Bosman
    PAQ/Refund would have been "right", since I found the solution, but I decided to give the points for your efforts in assisting me during some "difficult" hours. Thanks!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
    Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    884 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

    16 Experts available now in Live!

    Get 1:1 Help Now