dbTalk Databases Forums  

calculations

comp.databases.filemaker comp.databases.filemaker


Discuss calculations in the comp.databases.filemaker forum.



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

Default calculations - 01-30-2007 , 08:59 PM






I'm trying to create a calculation where I have a dropdown with five
choices. Each choice has a number value attached to it, but not seen
in the dropdown. Once the user chooses the specific choice the value
is sent to another area on the page that shows the total. Altogther
there are four total dropdowns each with the same five choices so that
once the user goes through each dropdown the total then is shown by
adding them all together.
For instance:

[DROPDOWN1] [[DROPDOWN2] [[DROPDOWN3] [[DROPDOWN4]
AB (30)
CD (10)
EF (-10)
GH (20)
IJ (40)
---------------------
[TOTAL]

So let's say Dropdown1, AB is chosen. Dropdown2 EF is chosen.
Dropdown3 CD is chosen. Dropdown4 GH is chosen. Then the total would
shown would be 50.

If anyone knows how to do this in Filemaker Pro 8.5 or less that would
be great!

Thank you,
Sean


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

Default Re: calculations - 01-30-2007 , 09:20 PM






In article <1170212382.568111.320510 (AT) q2g2000cwa (DOT) googlegroups.com>,
"sman" <sbenham (AT) gmail (DOT) com> wrote:

Quote:
I'm trying to create a calculation where I have a dropdown with five
choices. Each choice has a number value attached to it, but not seen
in the dropdown. Once the user chooses the specific choice the value
is sent to another area on the page that shows the total. Altogther
there are four total dropdowns each with the same five choices so that
once the user goes through each dropdown the total then is shown by
adding them all together.
For instance:

[DROPDOWN1] [[DROPDOWN2] [[DROPDOWN3] [[DROPDOWN4]
AB (30)
CD (10)
EF (-10)
GH (20)
IJ (40)
---------------------
[TOTAL]

So let's say Dropdown1, AB is chosen. Dropdown2 EF is chosen.
Dropdown3 CD is chosen. Dropdown4 GH is chosen. Then the total would
shown would be 50.

If anyone knows how to do this in Filemaker Pro 8.5 or less that would
be great!
Since the numbers are "not seen", there's numerous ways you could
achieve this.

If you do not need the separate numerical values for other reasons,
then probably the easiest is to create one new Calculation field to
combine all the drop-down values separated by Carriage Return
characters.
eg.
DropDownChoices Calculation, Text Result, Unstored
= DropDown1 & "#" & DropDown2 & "#" & DropDown3
& "#" & DropDown4 & "#"

where # is actually the carriage return character (the backwards "P"
that is on one of the buttons in the Define Calculation window).

Then your Total field can be a calculation something like:

Total Calculation, Number Result, Unstored
= PatternCount (DropDownChoices, "AB#") * 30
+ PatternCount (DropDownChoices, "CD#") * 10
+ PatternCount (DropDownChoices, "EF#") * -10
+ PatternCount (DropDownChoices, "GH#") * 20
+ PatternCount (DropDownChoices, "IJ#") * 40

where again the # is really the carriage return character.

This way it doesn't matter what order the choices are made in the
drop-down fields, and you only have to change the Total calculation if
any values change at a later date.

It works by simply counting the number of times each choice appears in
the combined DropDownChoices field and multiplies it by the value for
that choice, and adds those up to the Total.


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


Reply With Quote
  #3  
Old   
sman
 
Posts: n/a

Default Re: calculations - 02-01-2007 , 11:48 AM



On Jan 30, 9:20 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com>
wrote:
Quote:
In article <1170212382.568111.320... (AT) q2g2000cwa (DOT) googlegroups.com>,



"sman" <sben... (AT) gmail (DOT) com> wrote:
I'm trying to create a calculation where I have a dropdown with five
choices. Each choice has a number value attached to it, but not seen
in the dropdown. Once the user chooses the specific choice the value
is sent to another area on the page that shows the total. Altogther
there are four total dropdowns each with the same five choices so that
once the user goes through each dropdown the total then is shown by
adding them all together.
For instance:

[DROPDOWN1] [[DROPDOWN2] [[DROPDOWN3] [[DROPDOWN4]
AB (30)
CD (10)
EF (-10)
GH (20)
IJ (40)
---------------------
[TOTAL]

So let's say Dropdown1, AB is chosen. Dropdown2 EF is chosen.
Dropdown3 CD is chosen. Dropdown4 GH is chosen. Then the total would
shown would be 50.

If anyone knows how to do this in Filemaker Pro 8.5 or less that would
be great!

Since the numbers are "not seen", there's numerous ways you could
achieve this.

If you do not need the separate numerical values for other reasons,
then probably the easiest is to create one new Calculation field to
combine all the drop-down values separated by Carriage Return
characters.
eg.
DropDownChoices Calculation, Text Result, Unstored
= DropDown1 & "#" & DropDown2 & "#" & DropDown3
& "#" & DropDown4 & "#"

where # is actually the carriage return character (the backwards "P"
that is on one of the buttons in the Define Calculation window).

Then your Total field can be a calculation something like:

Total Calculation, Number Result, Unstored
= PatternCount (DropDownChoices, "AB#") * 30
+ PatternCount (DropDownChoices, "CD#") * 10
+ PatternCount (DropDownChoices, "EF#") * -10
+ PatternCount (DropDownChoices, "GH#") * 20
+ PatternCount (DropDownChoices, "IJ#") * 40

where again the # is really the carriage return character.

This way it doesn't matter what order the choices are made in the
drop-down fields, and you only have to change the Total calculation if
any values change at a later date.

It works by simply counting the number of times each choice appears in
the combined DropDownChoices field and multiplies it by the value for
that choice, and adds those up to the Total.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
------------------------------------------------------------------------------
Thanks HH,

I'm still a bit confused. Would I still define my choices for the
dropdown in the "Define Value Lists"? Or would the various choices be
on a separate table? Keeping this as simple as possible and in one
table would be the best.

Ok, you now state "the easiest is to create one new Calculation field
to combine all the drop-down values separated by Carriage Return
characters." Is this field different than the fields that contain each
dropdown? For instance I initially created four different fields each
that would point to the defined value list of the same choices. It
sounds like this is a new field that groups the other fields? I want
to make sure I get this point correct.

Many regards,
Sean



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

Default Re: calculations - 02-01-2007 , 01:59 PM



In article <1170352084.253618.304480 (AT) p10g2000cwp (DOT) googlegroups.com>,
"sman" <sbenham (AT) gmail (DOT) com> wrote:

Quote:
On Jan 30, 9:20 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com
wrote:
In article <1170212382.568111.320... (AT) q2g2000cwa (DOT) googlegroups.com>,
"sman" <sben... (AT) gmail (DOT) com> wrote:
I'm trying to create a calculation where I have a dropdown with five
choices. Each choice has a number value attached to it, but not seen
in the dropdown. Once the user chooses the specific choice the value
is sent to another area on the page that shows the total. Altogther
there are four total dropdowns each with the same five choices so that
once the user goes through each dropdown the total then is shown by
adding them all together.
For instance:

[DROPDOWN1] [[DROPDOWN2] [[DROPDOWN3] [[DROPDOWN4]
AB (30)
CD (10)
EF (-10)
GH (20)
IJ (40)
---------------------
[TOTAL]

So let's say Dropdown1, AB is chosen. Dropdown2 EF is chosen.
Dropdown3 CD is chosen. Dropdown4 GH is chosen. Then the total would
shown would be 50.

If anyone knows how to do this in Filemaker Pro 8.5 or less that would
be great!

Since the numbers are "not seen", there's numerous ways you could
achieve this.

If you do not need the separate numerical values for other reasons,
then probably the easiest is to create one new Calculation field to
combine all the drop-down values separated by Carriage Return
characters.
eg.
DropDownChoices Calculation, Text Result, Unstored
= DropDown1 & "#" & DropDown2 & "#" & DropDown3
& "#" & DropDown4 & "#"

where # is actually the carriage return character (the backwards "P"
that is on one of the buttons in the Define Calculation window).

Then your Total field can be a calculation something like:

Total Calculation, Number Result, Unstored
= PatternCount (DropDownChoices, "AB#") * 30
+ PatternCount (DropDownChoices, "CD#") * 10
+ PatternCount (DropDownChoices, "EF#") * -10
+ PatternCount (DropDownChoices, "GH#") * 20
+ PatternCount (DropDownChoices, "IJ#") * 40

where again the # is really the carriage return character.

This way it doesn't matter what order the choices are made in the
drop-down fields, and you only have to change the Total calculation if
any values change at a later date.

It works by simply counting the number of times each choice appears in
the combined DropDownChoices field and multiplies it by the value for
that choice, and adds those up to the Total.

Thanks HH,

I'm still a bit confused. Would I still define my choices for the
dropdown in the "Define Value Lists"? Or would the various choices be
on a separate table? Keeping this as simple as possible and in one
table would be the best.
It makes no difference to the above calculation how you store your
Value List items, but from the simple description you gave above I
can't see any need to have a separate Table / File.

There's only really two reasons to store them in a separate Table /
File:

- to make it easier for users to edit the available choices

- when needing Dynamic Value Lists where the list of options
in one Valu List driven field depends on the data in entered
into another field.
eg. If the user choose "Fruit" in first field then the
options in the second field become: Apple, Banana
If the user chooses "Vege" in the first field then
the options in the second field become: Cabbage, Carrot

Since you seem to have a simple Value List that doesn't fit into
either of these, you can just type the list into the Define Value Lists
window and not bother with a separate Table / File.




Quote:
Ok, you now state "the easiest is to create one new Calculation field
to combine all the drop-down values separated by Carriage Return
characters." Is this field different than the fields that contain each
dropdown? For instance I initially created four different fields each
that would point to the defined value list of the same choices. It
sounds like this is a new field that groups the other fields? I want
to make sure I get this point correct.
You need six fields:

DropDown1 Text Field using the Value List
User enters data choice

DropDown2 Text Field using the Value List
User enters data choice

DropDown3 Text Field using the Value List
User enters data choice

DropDown4 Text Field using the Value List
User enters data choice

DropDownChoices Calculation field as above

Total Calculation field as above


The DropDownChoices field just combines the user choosen values from
the separate DropDownX fields so that you can count the number of times
each option has been choosen using the PatternCount function. These
counts can then be multiplied by their individual numerical values to
obtain the total numerical value.


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


Reply With Quote
  #5  
Old   
sman
 
Posts: n/a

Default Re: calculations - 02-06-2007 , 03:30 PM



On Feb 1, 1:59 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com>
wrote:
Quote:
In article <1170352084.253618.304... (AT) p10g2000cwp (DOT) googlegroups.com>,



"sman" <sben... (AT) gmail (DOT) com> wrote:
On Jan 30, 9:20 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com
wrote:
In article <1170212382.568111.320... (AT) q2g2000cwa (DOT) googlegroups.com>,
"sman" <sben... (AT) gmail (DOT) com> wrote:
I'm trying to create a calculation where I have a dropdown with five
choices. Each choice has a number value attached to it, but not seen
in the dropdown. Once the user chooses the specific choice the value
is sent to another area on the page that shows the total. Altogther
there are four total dropdowns each with the same five choices so that
once the user goes through each dropdown the total then is shown by
adding them all together.
For instance:

[DROPDOWN1] [[DROPDOWN2] [[DROPDOWN3] [[DROPDOWN4]
AB (30)
CD (10)
EF (-10)
GH (20)
IJ (40)
---------------------
[TOTAL]

So let's say Dropdown1, AB is chosen. Dropdown2 EF is chosen.
Dropdown3 CD is chosen. Dropdown4 GH is chosen. Then the total would
shown would be 50.

If anyone knows how to do this in Filemaker Pro 8.5 or less that would
be great!

Since the numbers are "not seen", there's numerous ways you could
achieve this.

If you do not need the separate numerical values for other reasons,
then probably the easiest is to create one new Calculation field to
combine all the drop-down values separated by Carriage Return
characters.
eg.
DropDownChoices Calculation, Text Result, Unstored
= DropDown1 & "#" & DropDown2 & "#" & DropDown3
& "#" & DropDown4 & "#"

where # is actually the carriage return character (the backwards "P"
that is on one of the buttons in the Define Calculation window).

Then your Total field can be a calculation something like:

Total Calculation, Number Result, Unstored
= PatternCount (DropDownChoices, "AB#") * 30
+ PatternCount (DropDownChoices, "CD#") * 10
+ PatternCount (DropDownChoices, "EF#") * -10
+ PatternCount (DropDownChoices, "GH#") * 20
+ PatternCount (DropDownChoices, "IJ#") * 40

where again the # is really the carriage return character.

This way it doesn't matter what order the choices are made in the
drop-down fields, and you only have to change the Total calculation if
any values change at a later date.

It works by simply counting the number of times each choice appears in
the combined DropDownChoices field and multiplies it by the value for
that choice, and adds those up to the Total.

Thanks HH,

I'm still a bit confused. Would I still define my choices for the
dropdown in the "Define Value Lists"? Or would the various choices be
on a separate table? Keeping this as simple as possible and in one
table would be the best.

It makes no difference to the above calculation how you store your
Value List items, but from the simple description you gave above I
can't see any need to have a separate Table / File.

There's only really two reasons to store them in a separate Table /
File:

- to make it easier for users to edit the available choices

- when needing Dynamic Value Lists where the list of options
in one Valu List driven field depends on the data in entered
into another field.
eg. If the user choose "Fruit" in first field then the
options in the second field become: Apple, Banana
If the user chooses "Vege" in the first field then
the options in the second field become: Cabbage, Carrot

Since you seem to have a simple Value List that doesn't fit into
either of these, you can just type the list into the Define Value Lists
window and not bother with a separate Table / File.

Ok, you now state "the easiest is to create one new Calculation field
to combine all the drop-down values separated by Carriage Return
characters." Is this field different than the fields that contain each
dropdown? For instance I initially created four different fields each
that would point to the defined value list of the same choices. It
sounds like this is a new field that groups the other fields? I want
to make sure I get this point correct.

You need six fields:

DropDown1 Text Field using the Value List
User enters data choice

DropDown2 Text Field using the Value List
User enters data choice

DropDown3 Text Field using the Value List
User enters data choice

DropDown4 Text Field using the Value List
User enters data choice

DropDownChoices Calculation field as above

Total Calculation field as above

The DropDownChoices field just combines the user choosen values from
the separate DropDownX fields so that you can count the number of times
each option has been choosen using the PatternCount function. These
counts can then be multiplied by their individual numerical values to
obtain the total numerical value.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
It worked!! Fantastic. Thanks HH!



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.