Re: How to use "Checkbox set" in script
- From: Helpful Harry <helpful_harry@xxxxxxxxxxxxxxxx>
- Date: Sat, 06 Aug 2005 11:50:56 +1200
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)
.
- Follow-Ups:
- Re: How to use "Checkbox set" in script
- From: Léon Obers
- Re: How to use "Checkbox set" in script
- References:
- How to use "Checkbox set" in script
- From: leon . obers
- Re: How to use "Checkbox set" in script
- From: Dan
- Re: How to use "Checkbox set" in script
- From: Léon Obers
- Re: How to use "Checkbox set" in script
- From: Dan
- Re: How to use "Checkbox set" in script
- From: Dan
- How to use "Checkbox set" in script
- Prev by Date: Re: Grouping data with different headings
- Next by Date: Re: How to use "Checkbox set" in script
- Previous by thread: Re: How to use "Checkbox set" in script
- Next by thread: Re: How to use "Checkbox set" in script
- Index(es):
Relevant Pages
|