Unchecking a checkbox with lotusscript

Hi,

I have a checkbox with 9 different options. The user checks off what options they need and notifications get sent out. What I need to do is that if one of the people who receives the notification goes in and sets a specific field to value “Yes” then I need a one checkbox to be unchecked and have all the others remain as they are whether they are checked of unchecked. I am somewhat new at lotus script and lotus in general but have a good understanding if explained well.

Thanks in advance

Subject: Basically a checkbox is stored as

a multiple value text list.

When present in the user interface

marking a checkbox in the list adds a unique value to the list.

unchecking the box removes the corresponding value

(while leaving any other values unaltered)

Now lotus stores all items as multiple value anyway,

so a checkbox maps easily into that paradigm.

all you are really asking is how do I remove one value from a text list without affecting any others :slight_smile:

lets assume:

  1. the checkbox field is called CBF

  2. the value you wish to remove is “To Go”

then in formula that would be easy

FIELD CBF := @Trim( @Replace( CBF; “To Go” ; “” ) ) ;

Note:

a) the use of at replace to map values using two lists

b) the use of ‘lists’ that map only the target to blank

c) the fact that @Replace leaves other values in the source unchanged

d) the fact that @Replace does nothing if it finds no matches

e) the use of @Trim to remove the resultant blank entry in the list

So far so good - but you asked how to do this in LotusScript NOT Formula.

Well, if you are (relatively) new to Lotus you may not be aware of a powerful LotusScript tool - Evaluate

this allows you to use simple fomula statements in LS

which can sometimes ease complex manipulation of data

(especially those affecting lists)

Lets further aAssume that you have a handle onto the required document e.g.

Dim doc as Notesdocument

set doc = … .

then you can leverage your new formula like this

doc.CBF = Evaluate( {@Trim( @Replace( CBF; “To Go” ; “” ) ) } , doc )

Note here:

i) the use of implied property to assign the result list direct to the item (doc.cbf)

ii) The evaluate function Evaluate( formula string , on document)

iii) the use of { } to delimit the formula (allowing easier use of quotes in the formula)

Hope this helps. as always take a look in designer help for more detail

BTW:

you haven’t said how you are linking the setting of a field to “YES”

with the modification of the checklist

so I cant comment on where or how you would run this script

Let us know how you are doing this

and if you need further help

Subject: RE: Basically a checkbox is stored as

Hi,

Thank you, I was able to use the lotus script you gave me and it works great. to answer your question though, I set my field to “Yes” using a Submit Form button. I set a few fields within an If Then statement according to what parameters are met. I have tested everything and seems to do the job.

Thanks again!!