action checkbox

Lotus Notes dev:


I have a layer whithin a form containing a picture
I would like to set an option to hide/show this layer.

This option shouldn't be set within the form (as a field)  but rater as an temporary variable.
always set off by default when opening documents.

I was thinking of using an action checkbox setting an environment variable.
I'm trying to undertand how to use it but ther is absolutely no help about it.

then my questions are ?

Is it the best way to do it ?
Should I rather use a Profile document ?
Anyone have an example of an action checkbox ?
how to directly show/hide an element (with formula) ?
is @environment fast enougn and dynamic ?

best regards,

frederic Hesse
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use checkbox (say FLD1), In the input translation of the field enter this field

FIELD FLD1 := @DeleteField; ""

In this way it will delete the content of the field and not save..and just display null when opened next time.

I assume you are doing this for a Notes client release 6 or later, and not for a web browser.

You can do it as you described, but I thought you did not want to use a field?  A checkbox is a field!  If you want to use a checkbox, follow Hemantha's directions.  But you would need several more things.

1) On the Checkbox Options tab of the properties box, enable the option, "Refresh fields on keyword change."  Otherwise, checking/unchecking the box will have no immediate effect.

2) Let's say you name the checkbox DisplayLayer.  You need to make your layer sensitive to this field.  Place the cursor next to the layer anchor" (small icon, looks a bit like a DocLink, two white sheets of paper).  Open paragraph properties.  Click on the Hide-When tab.  Enable the option, "Hide paragraph when formula is true."  Add the following formula: DisplayLayer=""

Here's how  would do it:

1) Create a hidden field named HideLayer, Number type, computed for display, with the following formula: @If(@IsDocBeingLoaded; @False; DisplayLayer)

2) You need to make your layer sensitive to this field.  Place the cursor next to the "layer anchor" (small icon, looks a bit like a DocLink, two white sheets of paper).  Open paragraph properties.  Click on the Hide-When tab.  Enable the option, "Hide paragraph when formula is true."  Add the following formula: HideLayer

3) Display the action pane (View->Action Pane)

4) Create -> Action


6) Enable the Hide-When option, "Hide paragraph when formula is true."  Add the following formula: !HideLayer

7) Set the action formula (bottom pane) to: FIELD HideLayer := @False; @Command( [RefreshHideFormulas] )

8) Create a similar action, but the hide-when is (HideLayer) instead of (!HideLayer) and teh action formula sets (:=@True;) instead of (:=@False)
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

WhiteLotusAuthor Commented:
Dear Lotus devs,

I undertand that the easiest way to do it would be to insert a checkbox field. But I believe it is totaly unaceptable to insert a field in every single document in order to manage a general option.
My old c++ master would have killed me if I would have show up with such a solution ;-P.
I simply don't want to have (even one byte) of global variable stored in each document. thanks for helping me doing it.

I really would like to learn how to make a global var in LN or at least an environm. var.

Yes i'm on N6.0.3 not for web.
I asked for a checkbox action, I'm not quite sure about how actions are stored in lotus notes (is it stored as a field?).

I'll try your solution today. I think it is just what i need.
I'll give you a feed back. Thank you so much.

WhiteLotusAuthor Commented:
Another thing who is important:

 to enable/disable this layer , the user may not have the permission to change the document itself (thus no writing access to Hidelayer field)
Hmm, if there is no access to fields, then use an environment variable instead...

FIELD HideLayer := @False/@True;
ENVIRONMENT HideLayer := "0"/"1"

Hide formula (HideLayer) becomes (@Environment("HideLayer")="1"), and (!HideLayer) becomes (@Environment("HideLayer")="0")

And, you need to initialize the environment variable as the form loads.  The EASIEST way to do this is to create a hidden, computed for display field, at the VERY TOP of the formname does not matter.  the formula would be: @If(@IsDocBeingLoaded; @SetEnvironment("HideLayer";"0");DO_NOTHING_ON_REPEAT)
Action buttons are stored on the form definition, but are not stored with the document (unless you set forms to get stored in documents, an uncommon setting).
WhiteLotusAuthor Commented:
thank you for the great explainations,

It work but under a action button "hide" and another buton "show"

Now, i would like to merge it into an checkbox action.

this still doesn't work. when change the action display type from button to checkbox, a formula value field becomes available.

What is the PURPOSE of this field ?
How am I supposed to use it ?
What kind of formula lotus is expecting there ?

thank you so much .
You are confusing...

>the user may not have the permission to change the document itself (thus no writing access to Hidelayer field)

Meaning that some users can never see the document in edit that case how does checkbox work ? It won't ?
WhiteLotusAuthor Commented:
and what is DO_NOTHING_ON_REPEAT ?
Just a dummy variable.. instead you can put "" too
You really want to make me work hard, don't you?

I assume by this time you understand how environment variables work, and how @If works.  The new formula field (the tiny "@" button) repesenets a formula that determines whether the action btton checkbox is enabled or disabled.  If the formual evaluates to true, the checkbox goes on.  If it evaluates to flase, the checkbox is cleared.

The other thing you need to do is change the existing action formula from one that ALWAYS tunrs the variable on or always turns it off, to one tat retrieves the current value -- @Environment("HideLayer") -- then changes the  variable - @SetEnvironment("HideLayer"; new value) -- and runs @Command([RefereshHideFormulas]).  The same refreshhide will cause the checkbox formula to reevaluate.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WhiteLotusAuthor Commented:
EMANTHAKumur :  I'm aking and using an ACTION checkbox and not a checkbox FIELD.
there may be the confusion.

The way it finaly works (and edors right are not requested):

the checkbox action :
  on click:
    @Do(@Environment("HideLayer";"1");@Command( [ReloadWindow] ));
    @Do(@Environment("HideLayer"; "0");@Command( [ReloadWindow] )));
    @Command( [RefreshHideFormulas] );
    @Command( [RefreshWindow] )

  the Action checkbox display value :

the layer's hide when .. formula :

it is great ! and i have no extra hidden field there ;-)  thanks so much , and please .....
and what is DO_NOTHING_ON_REPEAT ?

Frederic Hesse
DO_NOTHING_ON_REPEAT is a variable.  Variables that are not asigned a value have a default value of null string.  So, I could have put in either:

@If(@IsDocBeingLoaded; @SetEnvironment("HideLayer";"0"); "")
@If(@IsDocBeingLoaded; @SetEnvironment("HideLayer";"0"); DO_NOTHING_ON_REPEAT)

Which do you think is more clear? The purpose is to reset the flag as the form loads, but not if the field recalculates any other time.  @If always requires an else clause.  So, for an else clause, you can use a null string if yuo want it to do nothing.  And I use a dummy variable instead of the null string to make it a litle more clear to someone examining the code.
WhiteLotusAuthor Commented:
Thanks so much.

It is quite funny to get so much troubble for a so simple thing.

I was just checking if your DO_NOTHING_ON_REPEAT wasn't a RESERVED variable or an hidden ;-P kind of weard parameter telling the compilator not to execute the @if() is included in a N6 formula loop.

Which do you think is more clear?
as i ever used the
@If(@IsDocBeingLoaded; @SetEnvironment("HideLayer";"0"); "")
style I'm just used to it :-)

I really appreciate your help and wonder what is leading you to spend (quite a lot of) time in order to answer people questions ?
Really, I would be interested to know ?

best regards
Fred Hesse

Beats me.  Too much time on my hands.  Need a job.
WhiteLotusAuthor Commented:
Should be easy for you to get a job ; if you are not already, got certified IBM ;-)

I'm based in geneva , switzerland , if I hear something I let you know.

A little far from New York, but...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.