![]() | |
#11
| |||
| |||
|
|
Thomas Hansen wrote on (11/4/2005): Is there an easy way to add the digits in a number together in Filemaker, ie. add the digits of the number 12 and get 3 as a result? Or do I have to do this manually, using middle(number; 1; 1) + middle(number; 2; 1)? I can't speak for FM designers, but I personally can't think of any mathematical basis for doing that. Unless someone else has some obscure numerical name for the process, I would have to say that your text parsing solution is your best bet. Matt |
#12
| |||
| |||
|
|
The sum of digits is used in a variety of mathematical proofs, theorems, and games. For example, to determine is a number is divisible by 9. When you have some spare time, do a Google search on "sum of digits" for some interesting exercises. The hard part of the problem seems to be the idea that there could be an arbitrary number of digits in the source number. This leads many to think that FileMaker Developer, a recursive function or some kind of script is required. Such is not the case. Given n, a text field, containing an integer with an arbitrary number of digits Evaluate ( Substitute (n; ["0";"0+"]; ["1";"1+"]; ["2";"2+"]; ["3";"3+"]; ["4";"4+"]; ["5";"5+"]; ["6";"6+"]; ["7";"7+"]; ["8";"8+"]; ["9";"9+"]) & "0") Will return the sum of those digits. Enjoy, Bill |
#13
| |||
| |||
|
|
In article <LImdnVKtRZ1sqPHenZ2dnUVZ_tKdnZ2d (AT) comcast (DOT) com>, wjm (AT) wjm (DOT) org says... The sum of digits is used in a variety of mathematical proofs, theorems, and games. For example, to determine is a number is divisible by 9. When you have some spare time, do a Google search on "sum of digits" for some interesting exercises. The hard part of the problem seems to be the idea that there could be an arbitrary number of digits in the source number. This leads many to think that FileMaker Developer, a recursive function or some kind of script is required. Such is not the case. Given n, a text field, containing an integer with an arbitrary number of digits Evaluate ( Substitute (n; ["0";"0+"]; ["1";"1+"]; ["2";"2+"]; ["3";"3+"]; ["4";"4+"]; ["5";"5+"]; ["6";"6+"]; ["7";"7+"]; ["8";"8+"]; ["9";"9+"]) & "0") Will return the sum of those digits. Enjoy, Bill Cool solution, Bill. Although I think the notion of recusion wasn't on an arbitrary number of digits, it was on the idea that you might have to perform the addition an arbitrary number of times until you just had one digit. (although the mod9 solution dodges that) -regards, Dave |
#14
| |||
| |||
|
|
The root "tverr" came back as "crabby, fractious, glum, moody, peevish, sulky, sullen" |
#15
| |||
| |||
|
|
Thanks to all who helped. I ended up doing it manually - the number itself was a result of a calculation and would end up with one or to digits, so instead of checking the number of digits and then adding them together, I was hoping there was a more elegant way in Filemaker. That doesn't seem to be, though. In article <GKHaf.3665$y23.2443@trndny08>, "Matt Wills" <I'm (AT) Witz (DOT) end wrote: The root "tverr" came back as "crabby, fractious, glum, moody, peevish, sulky, sullen" Heh. :-) I guess that would be a correct translation for one meaning of the word. However, this version of "tverr" comes from the word "tvers", meaning something like "across". Thus, "tverrsum" would translate into something like "sum across" (across the number, that is). Discussion to follow in comp.databases.filemaker.learningnorwegian :-) -- Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/ |
#16
| |||
| |||
|
|
Thanks to all who helped. I ended up doing it manually - the number itself was a result of a calculation and would end up with one or to digits, so instead of checking the number of digits and then adding them together, I was hoping there was a more elegant way in Filemaker. That doesn't seem to be, though. In article <GKHaf.3665$y23.2443@trndny08>, "Matt Wills" <I'm (AT) Witz (DOT) end wrote: The root "tverr" came back as "crabby, fractious, glum, moody, peevish, sulky, sullen" Heh. :-) I guess that would be a correct translation for one meaning of the word. However, this version of "tverr" comes from the word "tvers", meaning something like "across". Thus, "tverrsum" would translate into something like "sum across" (across the number, that is). Discussion to follow in comp.databases.filemaker.learningnorwegian :-) -- Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/ |
#17
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |