dbTalk Databases Forums  

Validation by Calculation

comp.databases.filemaker comp.databases.filemaker


Discuss Validation by Calculation in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeff Wright
 
Posts: n/a

Default Validation by Calculation - 04-07-2007 , 05:27 AM






Hi Using FM 8.5 Pro Adv on Windows XP

I have a text field 'con_use', which I have placed on a layout as a
checkbox. I have set up a value list with just one line 'Use In
Correspondence', which I have set up to display in this checkbox on my
layout.

Obviously (I suppose its obvious!), the field in question, set up as it is
on my layout, should equal one of two values, either 'Use In Correspondence'
or an empty value. So far so good.

Now I have noticed that it is possible to drag and drop values from fields
to fields including checkboxes. I know it is possible to turn this option
off, but it seems a useful option to keep enabled. As I say it is possible
to drop a value into a checkbox, which in the case of 'con_use' would most
likely result in the field containing an invalid value.

To overcome this I have attempted to set up within the field definition a
'Validation by Calculation' option, but however I go about this it just does
not want to work as I think it should.

I have entered in the calculation box
"Use In Correspondence" or ""
and have unchecked the 'Validate only if field has been modified' box and
have set the 'always validate data in this field' button.

I always get the error
'con_use' is defined to contain only specific values. You must enter a valid
value
when I click on the checkbox then click somewhere else on the layout, which
I don't think should be happening, as when clicking on the checkbox con_use
is being given a valid value.

My first thought was perhaps I entered the calculation in the calculation
box incorrectly. Should it read
con_use = "Use In Correspondence" or con_use = ""

Hope the above all makes sense !!

--
Jeff Wright



Reply With Quote
  #2  
Old   
Grip
 
Posts: n/a

Default Re: Validation by Calculation - 04-07-2007 , 09:33 AM






On Apr 7, 4:27 am, "Jeff Wright" <j... (AT) jeffwright (DOT) demon.co.uk> wrote:
Quote:
Hi Using FM 8.5 Pro Adv on Windows XP

I have a text field 'con_use', which I have placed on a layout as a
checkbox. I have set up a value list with just one line 'Use In
Correspondence', which I have set up to display in this checkbox on my
layout.

Obviously (I suppose its obvious!), the field in question, set up as it is
on my layout, should equal one of two values, either 'Use In Correspondence'
or an empty value. So far so good.

Now I have noticed that it is possible to drag and drop values from fields
to fields including checkboxes. I know it is possible to turn this option
off, but it seems a useful option to keep enabled. As I say it is possible
to drop a value into a checkbox, which in the case of 'con_use' would most
likely result in the field containing an invalid value.

Quote:
My first thought was perhaps I entered the calculation in the calculation
box incorrectly. Should it read
con_use = "Use In Correspondence" or con_use = ""

This is an interesting 'feature' of checkboxes and radio buttons I
never noticed. This is the kind of thing can keep me up at night,
wondering how many little holes are in my solutions.

Quote:
Should it read
con_use = "Use In Correspondence" or con_use = ""

Yes, that would work. You need to include the field name itself in
your test. I prefer:

Case(
IsEmpty(con_use); 1;
con_use = "Use In Correspondence"; 1;
0)


Problem is users won't understand what they've done wrong. As far as
they can see the field is empty but they're getting an error message.
They'll have to check and uncheck on the field to straighten the
values out. And a checkbox won't work here, it has to be a radio
button.

You might want to consider an auto-enter calculation always replace
instead. Put the above Case statement in and replace the 1s with
con_use and the 0 with "".

G



Reply With Quote
  #3  
Old   
Jeff Wright
 
Posts: n/a

Default Re: Validation by Calculation - 04-07-2007 , 02:37 PM



Hi Grip

Change "interesting feature" to "annoying feature!". So I'm not the only
that stays up all night trying to solve little problems!

It was only by accident that I discovered the drag and drop feature that
also works on check boxes. Your solution works well - many thanks!

I agree with your comments that "users won't understand what they've done
wrong", using the validation by calculation method

--
Jeff Wright

"Grip" <grip (AT) cybermesa (DOT) com> wrote

Quote:
On Apr 7, 4:27 am, "Jeff Wright" <j... (AT) jeffwright (DOT) demon.co.uk> wrote:
Hi Using FM 8.5 Pro Adv on Windows XP

I have a text field 'con_use', which I have placed on a layout as a
checkbox. I have set up a value list with just one line 'Use In
Correspondence', which I have set up to display in this checkbox on my
layout.

Obviously (I suppose its obvious!), the field in question, set up as it
is
on my layout, should equal one of two values, either 'Use In
Correspondence'
or an empty value. So far so good.

Now I have noticed that it is possible to drag and drop values from
fields
to fields including checkboxes. I know it is possible to turn this option
off, but it seems a useful option to keep enabled. As I say it is
possible
to drop a value into a checkbox, which in the case of 'con_use' would
most
likely result in the field containing an invalid value.


My first thought was perhaps I entered the calculation in the calculation
box incorrectly. Should it read
con_use = "Use In Correspondence" or con_use = ""


This is an interesting 'feature' of checkboxes and radio buttons I
never noticed. This is the kind of thing can keep me up at night,
wondering how many little holes are in my solutions.

Should it read
con_use = "Use In Correspondence" or con_use = ""


Yes, that would work. You need to include the field name itself in
your test. I prefer:

Case(
IsEmpty(con_use); 1;
con_use = "Use In Correspondence"; 1;
0)


Problem is users won't understand what they've done wrong. As far as
they can see the field is empty but they're getting an error message.
They'll have to check and uncheck on the field to straighten the
values out. And a checkbox won't work here, it has to be a radio
button.

You might want to consider an auto-enter calculation always replace
instead. Put the above Case statement in and replace the 1s with
con_use and the 0 with "".

G




Reply With Quote
  #4  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Validation by Calculation - 04-07-2007 , 06:15 PM



In article <ev7rmt$4if$1$8302bc10 (AT) news (DOT) demon.co.uk>, "Jeff Wright"
<jeff (AT) jeffwright (DOT) demon.co.uk> wrote:

Quote:
Hi Using FM 8.5 Pro Adv on Windows XP

I have a text field 'con_use', which I have placed on a layout as a
checkbox. I have set up a value list with just one line 'Use In
Correspondence', which I have set up to display in this checkbox on my
layout.

Obviously (I suppose its obvious!), the field in question, set up as it is
on my layout, should equal one of two values, either 'Use In Correspondence'
or an empty value. So far so good.

Now I have noticed that it is possible to drag and drop values from fields
to fields including checkboxes. I know it is possible to turn this option
off, but it seems a useful option to keep enabled. As I say it is possible
to drop a value into a checkbox, which in the case of 'con_use' would most
likely result in the field containing an invalid value.

To overcome this I have attempted to set up within the field definition a
'Validation by Calculation' option, but however I go about this it just does
not want to work as I think it should.

I have entered in the calculation box
"Use In Correspondence" or ""
and have unchecked the 'Validate only if field has been modified' box and
have set the 'always validate data in this field' button.

I always get the error
'con_use' is defined to contain only specific values. You must enter a valid
value
when I click on the checkbox then click somewhere else on the layout, which
I don't think should be happening, as when clicking on the checkbox con_use
is being given a valid value.

My first thought was perhaps I entered the calculation in the calculation
box incorrectly. Should it read
con_use = "Use In Correspondence" or con_use = ""

Hope the above all makes sense !!
As Grip says, this second version is correct.

Another way is to use the Validation option "Member of value list".
This option only allows the field to be empty or one of the values on
the chosen value list.


There is also another annoying "feature" to be aware of (that also
turns up in web broswer forms) - you can actually enter multiple values
in a Radio Button field instead of the usual ONE choice only.

This means that testing even a Radio Button field for a particular
value should not be done using

If (Field = "Option", ...)

Instead the PatternCount or Position functions should be used.
ie.
If (PatternCount(Field, "Option") <> 0, ...)
or
If (Position(Field, "Option", 0, 1) <> 0, ...)



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


Reply With Quote
  #5  
Old   
Jeff Wright
 
Posts: n/a

Default Re: Validation by Calculation - 04-09-2007 , 01:13 AM



Thanks for that Harry.

Yes I have now found that I need to use your method of "Member of Value
list" validation.

This is due to the fact that one set of checkboxes I have need to have their
values changed depending on which other checkboxes are checked. The way I
have gone about this is by calling a script to do the necessary calculaton.
Unfortunately, this falls apart if text is dragged onto one of the
checkboxes, as the script is not called. However, the "Member of Value list"
validation cures this problem.

Seems a lot of work for something that might not happen, but I guess that's
what you get for trying to create something that is as user friendly as
possible!

And I have noted your comments about the other "annoying feature"!

--
Jeff Wright


"Helpful Harry" <helpful_harry (AT) nom (DOT) de.plume.com> wrote

Quote:
In article <ev7rmt$4if$1$8302bc10 (AT) news (DOT) demon.co.uk>, "Jeff Wright"
jeff (AT) jeffwright (DOT) demon.co.uk> wrote:

Hi Using FM 8.5 Pro Adv on Windows XP

I have a text field 'con_use', which I have placed on a layout as a
checkbox. I have set up a value list with just one line 'Use In
Correspondence', which I have set up to display in this checkbox on my
layout.

Obviously (I suppose its obvious!), the field in question, set up as it
is
on my layout, should equal one of two values, either 'Use In
Correspondence'
or an empty value. So far so good.

Now I have noticed that it is possible to drag and drop values from
fields
to fields including checkboxes. I know it is possible to turn this option
off, but it seems a useful option to keep enabled. As I say it is
possible
to drop a value into a checkbox, which in the case of 'con_use' would
most
likely result in the field containing an invalid value.

To overcome this I have attempted to set up within the field definition a
'Validation by Calculation' option, but however I go about this it just
does
not want to work as I think it should.

I have entered in the calculation box
"Use In Correspondence" or ""
and have unchecked the 'Validate only if field has been modified' box and
have set the 'always validate data in this field' button.

I always get the error
'con_use' is defined to contain only specific values. You must enter a
valid
value
when I click on the checkbox then click somewhere else on the layout,
which
I don't think should be happening, as when clicking on the checkbox
con_use
is being given a valid value.

My first thought was perhaps I entered the calculation in the calculation
box incorrectly. Should it read
con_use = "Use In Correspondence" or con_use = ""

Hope the above all makes sense !!

As Grip says, this second version is correct.

Another way is to use the Validation option "Member of value list".
This option only allows the field to be empty or one of the values on
the chosen value list.


There is also another annoying "feature" to be aware of (that also
turns up in web broswer forms) - you can actually enter multiple values
in a Radio Button field instead of the usual ONE choice only.

This means that testing even a Radio Button field for a particular
value should not be done using

If (Field = "Option", ...)

Instead the PatternCount or Position functions should be used.
ie.
If (PatternCount(Field, "Option") <> 0, ...)
or
If (Position(Field, "Option", 0, 1) <> 0, ...)



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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.