Conditionally set a group of field values? 
Author Message
 Conditionally set a group of field values?

I have a sales form with billing address info and shipping address
info.

I want to have a checkbox or a yes/no radio button that the user can
click to have the form fill in the shipping address info with the
billing address info  (Same as Billing)

Shipping fields can't be calculations, because the user has to be able
to enter data in them. I tried setting the initial value of each field
to be calculated and set it conditionally. For example:
(If CheckBox= "Yes", Billing Name, " ")

The result is that if I click Yes, the shipping fields get
auto-filled, but i can't click No and have them get cleared.

Is there a way to use a checkbox or radio button as a trigger to
modify field values, or is there another way to do what I'm trying to
do?

gary



Sun, 20 Mar 2005 14:17:52 GMT
 Conditionally set a group of field values?

You can force a lookup, using a self-join relationship, to the billing
address. Define the lookup to enter a blank value where there is no match.
When defining a field as a lookup, there is a choice, which we often ignore,
for what to enter if the match fails, and the fourth choice is a hard-coded
value. If that choice is selected, and the value left empty, the lookup will
actually revert to empty when relationship 'fails'.

To create the relationship, first make your 'choice' field a number field,
displayed as a radio button using 'Yes' and 'No' (which are accepted as 1
and 0). Then, create two calcs, each returning text.

ID_1 = ID & " "  & 1
ID_YN = ID & " " Choice

...wher 'ID' is the customer ID (usually a unique, auto-enterd number), and
'Choice' is the choice field, toggled by the user.

Create a relationship from ID_YN to ID_1, and define the shipping address as
described above-- a lookup to the billing address, where an empty value is
used when the lookup fails.

--
John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Associate Member, Filemaker Solutions Alliance


Quote:
> I have a sales form with billing address info and shipping address
> info.

> I want to have a checkbox or a yes/no radio button that the user can
> click to have the form fill in the shipping address info with the
> billing address info  (Same as Billing)

> Shipping fields can't be calculations, because the user has to be able
> to enter data in them. I tried setting the initial value of each field
> to be calculated and set it conditionally. For example:
> (If CheckBox= "Yes", Billing Name, " ")

> The result is that if I click Yes, the shipping fields get
> auto-filled, but i can't click No and have them get cleared.

> Is there a way to use a checkbox or radio button as a trigger to
> modify field values, or is there another way to do what I'm trying to
> do?

> gary



Sun, 20 Mar 2005 22:57:32 GMT
 Conditionally set a group of field values?
Another option:

Use a script to fill in or clear the Shipping Address info based upon the
selection in the check box (only "Yes" is required..."No" can be assumed if
"Yes" is un-checked).  Instead of actually clicking on the check box, you
place an "invisible" button over the top of the field which runs a script
similar to the following:

If [CheckboxField = "Yes"]
  Set Field [CheckboxField, ""]
  Set Field [ShippingAddress, ""]
Else
  Set Field [CheckboxField, "Yes"]
  Set Field [ShippingAddress, BillingAddress]
End If

Be sure to remove the CheckboxField from the tab order and un-check "Allow
entry into field" in the Field Format dialog.


Quote:
> I have a sales form with billing address info and shipping address
> info.

> I want to have a checkbox or a yes/no radio button that the user can
> click to have the form fill in the shipping address info with the
> billing address info  (Same as Billing)

> Shipping fields can't be calculations, because the user has to be able
> to enter data in them. I tried setting the initial value of each field
> to be calculated and set it conditionally. For example:
> (If CheckBox= "Yes", Billing Name, " ")

> The result is that if I click Yes, the shipping fields get
> auto-filled, but i can't click No and have them get cleared.

> Is there a way to use a checkbox or radio button as a trigger to
> modify field values, or is there another way to do what I'm trying to
> do?

> gary



Sun, 20 Mar 2005 23:47:37 GMT
 Conditionally set a group of field values?
Better yet (maybe?)...

Change the CheckboxField to a calculation:

CheckboxField (calculation, text) = If ((ShipAddress = BillAddress) and
(ShipCity = BillCity) and (ShipState = BillState), "Yes", "")

I assumed this time that your addresses are not all in one field, which is
usually not the case.  Compare as many fields as is necessary to be sure
that they are identical.

Change the script to the following:

If [CheckboxField = "Yes"]
  Set Field [ShipAddress, ""]
  Set Field [ShipCity, ""]
  Set Field [ShipState, ""]
  [ Include all of your Ship Address fields]
Else
  Set Field [ShipAddress, BillAddress]
  Set Field [ShipCity, BillCity]
  Set Field [ShipState, BillState]
  [ Include all of your address fields that need to be copied, especially
the ones in the CheckboxField calculation ]
End If

The advantage is that if the shipping address is substantially similar to
the billing address but not exactly the same, you can click "Yes" which will
copy the billing address over, then make changes to the shipping address as
needed.  Making changes will automatically un-check "Yes" but will not clear
the shipping address field.  This would avoid the appearance that the two
addresses are the same ("Yes" would have been checked) even though changes
had been made to the shipping address.

The downside is that now you may want to add a "Clear Shipping Address"
button, because once the shipping address has been copied and then changed,
you would need to click "Yes" twice to clear it, which isn't very intuitive.


Quote:
> Another option:

> Use a script to fill in or clear the Shipping Address info based upon the
> selection in the check box (only "Yes" is required..."No" can be assumed
if
> "Yes" is un-checked).  Instead of actually clicking on the check box, you
> place an "invisible" button over the top of the field which runs a script
> similar to the following:

> If [CheckboxField = "Yes"]
>   Set Field [CheckboxField, ""]
>   Set Field [ShippingAddress, ""]
> Else
>   Set Field [CheckboxField, "Yes"]
>   Set Field [ShippingAddress, BillingAddress]
> End If

> Be sure to remove the CheckboxField from the tab order and un-check "Allow
> entry into field" in the Field Format dialog.



> > I have a sales form with billing address info and shipping address
> > info.

> > I want to have a checkbox or a yes/no radio button that the user can
> > click to have the form fill in the shipping address info with the
> > billing address info  (Same as Billing)

> > Shipping fields can't be calculations, because the user has to be able
> > to enter data in them. I tried setting the initial value of each field
> > to be calculated and set it conditionally. For example:
> > (If CheckBox= "Yes", Billing Name, " ")

> > The result is that if I click Yes, the shipping fields get
> > auto-filled, but i can't click No and have them get cleared.

> > Is there a way to use a checkbox or radio button as a trigger to
> > modify field values, or is there another way to do what I'm trying to
> > do?

> > gary



Mon, 21 Mar 2005 00:19:58 GMT
 Conditionally set a group of field values?
Thanks so much Glenn.

I never would have thought of that stroke of genius: using an
invisible button, which works like a charm

thanks again,
   gary

On Wed, 2 Oct 2002 11:19:58 -0500, "Glenn Schwandt"

Quote:

>Better yet (maybe?)...

>Change the CheckboxField to a calculation:

>CheckboxField (calculation, text) = If ((ShipAddress = BillAddress) and
>(ShipCity = BillCity) and (ShipState = BillState), "Yes", "")

>I assumed this time that your addresses are not all in one field, which is
>usually not the case.  Compare as many fields as is necessary to be sure
>that they are identical.

>Change the script to the following:

>If [CheckboxField = "Yes"]
>  Set Field [ShipAddress, ""]
>  Set Field [ShipCity, ""]
>  Set Field [ShipState, ""]
>  [ Include all of your Ship Address fields]
>Else
>  Set Field [ShipAddress, BillAddress]
>  Set Field [ShipCity, BillCity]
>  Set Field [ShipState, BillState]
>  [ Include all of your address fields that need to be copied, especially
>the ones in the CheckboxField calculation ]
>End If

>The advantage is that if the shipping address is substantially similar to
>the billing address but not exactly the same, you can click "Yes" which will
>copy the billing address over, then make changes to the shipping address as
>needed.  Making changes will automatically un-check "Yes" but will not clear
>the shipping address field.  This would avoid the appearance that the two
>addresses are the same ("Yes" would have been checked) even though changes
>had been made to the shipping address.

>The downside is that now you may want to add a "Clear Shipping Address"
>button, because once the shipping address has been copied and then changed,
>you would need to click "Yes" twice to clear it, which isn't very intuitive.



>> Another option:

>> Use a script to fill in or clear the Shipping Address info based upon the
>> selection in the check box (only "Yes" is required..."No" can be assumed
>if
>> "Yes" is un-checked).  Instead of actually clicking on the check box, you
>> place an "invisible" button over the top of the field which runs a script
>> similar to the following:

>> If [CheckboxField = "Yes"]
>>   Set Field [CheckboxField, ""]
>>   Set Field [ShippingAddress, ""]
>> Else
>>   Set Field [CheckboxField, "Yes"]
>>   Set Field [ShippingAddress, BillingAddress]
>> End If

>> Be sure to remove the CheckboxField from the tab order and un-check "Allow
>> entry into field" in the Field Format dialog.



>> > I have a sales form with billing address info and shipping address
>> > info.

>> > I want to have a checkbox or a yes/no radio button that the user can
>> > click to have the form fill in the shipping address info with the
>> > billing address info  (Same as Billing)

>> > Shipping fields can't be calculations, because the user has to be able
>> > to enter data in them. I tried setting the initial value of each field
>> > to be calculated and set it conditionally. For example:
>> > (If CheckBox= "Yes", Billing Name, " ")

>> > The result is that if I click Yes, the shipping fields get
>> > auto-filled, but i can't click No and have them get cleared.

>> > Is there a way to use a checkbox or radio button as a trigger to
>> > modify field values, or is there another way to do what I'm trying to
>> > do?

>> > gary



Mon, 21 Mar 2005 01:24:37 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Help to set local variable equal to value of field in result set

2. Setting boolean field from date field values...

3. SQL: conditionally return string constants for certain fields

4. Help with conditionally created field in SELECT

5. Conditionally concatenating fields in select statement?

6. Getting field value from the first record in a group by SQL

7. How do you conditionally disable/enable a field on a form

8. Conditionally moving to next field on form

9. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

10. Incrementing Next Field's Value Based Upon Prior Field's Value

11. Check for NULL field value without returning field value

12. Setting default value of field...having problems


 
Powered by phpBB® Forum Software