Re: How to use "Checkbox set" in script



In article <LuidnZKLC6opvm7fRVnytQ@xxxxxxxxxxxxxx>, "Dan"
<dan@xxxxxxxxxxxxx> wrote:

> Dan wrote:
> > Léon Obers wrote:
> >> Dan wrote:
> >>
> >>> leon.obers@xxxxxx wrote:
> >>
> >>>> In a record I do use a field with several text options that can be
> >>>> set as "X" or "empty" of the used "Checkbox set".
> >>
> >>>> How to use "Checkbox set" within a script, so I can check or
> >>>> uncheck the box automatically (e.g. for a found set by using loop
> >>>> function). Also how to use the script when the second or third
> >>>> checkbox has to be set.
> >>
> >>> The checkbox being set puts the text option into the field,
> >>> multi-checks put the options separated by carriage returns. So to
> >>> get the checkbox to show x you have to put the appropriate text
> >>> option into the field. If you want to keep the existing field
> >>> contents (for multi-checked case) then do a SetField which includes
> >>> the original field & "¶" & the new option.
> >>
> >> I have tried to find out what you mean and how to use it in a script,
> >> but unfortunately I don't understand.
> >>
> >> Can you give examples how to change the value of the "check" within a
> >> script, and wich functions to use?
> >>
> >> Fieldname: "Order"
> >> Text as set within a "Checkbox set" (in checked mode):
> >>
> >> X Packed
> >> X Send
> >
> > OK This is a script to which you pass a parameter "On" or "Off" . I am
> > writing it with a field Order for the Checkboxes and a field Value
> > containing the value. You can replace Value throughout with a constant
> > text string like "packed". I will confess it is a bit trickier than I
> > though, particularly removing a check but I have tested this and it
> > seems to work OK The outer If and Else if is just picking up the On or
> > Off parameters, The first inner if End If checks that the value is not
> > there already before adding it. The seconf inner If End If makes sure
> > it is there before trying to remove it.
> >
> > If[Get(ScriptParameter)="On"]
> > If[PatternCount(Order;Value)=0]
> > SetField[Order;Order & Value & "¶"
> > End If
> > Else If[Get(ScriptParameter)="Off"]
> > If[PatternCount(Order;Value) > 0]
> > SetField[Order;Replace (Order;
> > Position(Order;Value;0;1);Length(Value)+1;"" )
> > End If
> > End If
>
> I tested this a bit more this morning and there are problems if you
> allow users to click the checkboxes before scripting them because a
> single checked box does not have a carriage return in the field. This
> problem can be resolved by changing the order of concatenation in the
> first SetField
>
> SetField[Order;Value & "¶" & Order]
>
> Harry's solution avoids this problem by putting the carriage return at
> the front but then when removing a check then, as he has done, it is
> necessary to check for double carriage returns.

My method has the problem of leaving a single carriage return if you
turn off all the options (after turning on one or more) - but it's
usually not a problem, unless you're using a normal version of the
field in a printed report ... even then sliding may get rid of it
anyway, but I haven't "checked" that. ;o)



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
.



Relevant Pages

  • Re: finding out user
    ... It looks like when I pasted the code into the post, many carriage returns ... Your error message will indicate the line number in the script ... If you aren't used to this it can be tricky, but the error message should ... filter user objects. ...
    (microsoft.public.win2000.active_directory)
  • Re: Custom WinLogon message
    ... If a script can be put together to do this, ... if someone provided a script in a language I ... The message will be consistent across all servers. ... message as well as the carriage returns so I can push this custom message ...
    (microsoft.public.win32.programmer.ui)
  • Re: Moving a string from VBScript to JScript
    ... sequence for carriage return). ... If your script is in JScript, ... > the conversion lost the carrier return. ... >> Vassiliev V. V. ...
    (microsoft.public.scripting.jscript)
  • Re: Problem with Applescript PASTE function in MS Word
    ... > gotten the script from George Clark on this or another board, ... "quotes") now contains Unix Linefeeds rather than Mac Carriage Returns, ... now the VB Editor is not seeing them as separate lines. ... change that vbLf to vbCr it just might fix it. ...
    (microsoft.public.mac.office.word)
  • Re: additem removeitem
    ... Try removing them the in reverse order... ... Can't figure out why the following script won't remove selected items ... Dim X As Integer ...
    (microsoft.public.excel.programming)