![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, 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. Thanks in advise. Regards, Leon Obers |
#3
| |||
| |||
|
|
leon.obers (AT) iae (DOT) nl 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. |
#4
| |||
| |||
|
|
Dan wrote: leon.obers (AT) iae (DOT) nl 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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
Léon Obers wrote: Dan wrote: leon.obers (AT) iae (DOT) nl 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 |
#7
| |||
| |||
|
|
Dan wrote: Léon Obers wrote: Dan wrote: leon.obers (AT) iae (DOT) nl 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. |
#8
| |||
| |||
|
|
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. |
#9
| |||
| |||
|
|
Léon Obers wrote: 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 "Checkbox" fields are simply normal text fields that store the values that are checked, each spearated by a return character (¶). The best way to see how they work is to duplicate the checkbox field on a lyout and change its formatting back to "normal" field - then playing with the values of the checkbox version in browse mode will show you how FileMaker sets the fields real data in the "normal" version. |
#10
| |||
| |||
|
|
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 ... |
![]() |
| Thread Tools | |
| Display Modes | |
| |