Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4617 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hello all

i am a novice user of fmp 12.

i have this question in my mind can't figure out

i have 2 tables as follows:

table A named "Alphabet" with 2 fields ----> "Letters" , "Value"

table B named "Data" with 2 fields ----> "Words" , "Value"

in table A i have all the letters of the alphabet in the "Letters" field , and in the field "Value" a number for each letter.

I want in table B to enter words in the "Words" field , and when i do that , i want in the "Value" field of table B to automatically filled with the sum of the letters of the word i enter.

for example:

table A

A=1

B=2

C=3

D=4

E=5

F=6

G=7

table B

CAB=6

BAD=7

FADE=16

is this possible to be done?

thanks very much in advance for any answers

Posted

I hope this is what you wanted; CF isn't too elegant (could do with a helper CF for counter initialization),

but does the job.

EDIT: not quite …

  • Newbies
Posted

I hope this is what you wanted; CF isn't too elegant (could do with a helper CF for counter initialization),

but does the job.

yes something like this ...only problem is it doesn't do the sum correct . i tried some words and gives me incorrect result.

but it is very close to that i want thanks

i will study your example to see how you make it

Posted

You're right, I had forgotten that multiple instances of the same letter still only give one match result, so the sum is too low.

(Also there was an extraneous record for letter “H” in the alphabet list; teaches you to always check your data first …)

Here's an improved version which uses a script to loop over the individual letters and sum up their values. Hopefully works

correctly now (unless I've overlooked something else ;-)

SumLetterValuesv02_eos.fmp12.zip

Posted

No need for custom functions or scripts...


Let(



[

fld = fieldname ; // <--- field here

txt = Filter( Upper( fld ) ; "ABCDEFG" ) ;

calc = Substitute( txt ;

  [ "A" ; "1+" ] ;

  [ "B" ; "2+" ] ;

  [ "C" ; "3+" ] ;

  [ "D" ; "4+" ] ;

  [ "E" ; "5+" ] ;

  [ "F" ; "6+" ] ;

  [ "G" ; "7+" ]

  ) & "0"

] ;



Evaluate( calc )



)

Posted

Be careful with Evaluate(). Notice that I process what gets sent to the function with the Filter() function.

If that wasn't there, what would happen if these values was entered into the calculation:

A3*2*BC

1/0+CAD

Posted

It would be helpful to know what this is about. It seems like the individual letters are (or should be) records in a related table; converting each letter individually, then summing the results would be a more robust solution.

Posted

Be careful with Evaluate(). Notice that I process what gets sent to the function with the Filter() function.

Yes, I did notice ;)

It would be helpful to know what this is about. It seems like the individual letters are (or should be) records in a related table; converting each letter individually, then summing the results would be a more robust solution.

This was my approach with a triggered looping script.

Posted

No, I meant convert each letter while it still stands alone in its own record. There would be no looping script and no triggering required, just a simple Sum() calculation.

Posted

No, I meant convert each letter while it still stands alone in its own record. There would be no looping script and no triggering required, just a simple Sum() calculation.

Can you be a bit more concrete? My first idea was to generate a multi-key from the string to match on an alphabet table - where each letter has its own record with an associated value - and Sum () up the results, but (as I noted above) this approach doesn't account for multiple instances of the same letter.

Posted

You are starting from the string; I am assuming the string is the result of concatenating individual letters. I am suggesting the letters should be converted to their numerical equivalents before (or instead) being concatenated into a string.

Posted

The OP said he/she wanted to “to enter words in the "Words" field”, that why I was starting from the string. Without knowing the actual purpose and/or workflow involved, it is hard to tell which method is best suited; but as usual, the nice thing about FileMaker is that there is more than one way to skin a cat.

Posted

The OP said he/she wanted to “to enter words in the "Words" field”

So they did - and I said it would be helpful to know what this is about.

  • Newbies
Posted

woww i see more answers today i am very glad :)

well to give you a hint what i want to do is that i want to convert words that i enter into a lexarithmic value. Also i want the words i enter to be stored so i can process them later.

btw i am "he" :P you can call me Tasos (short name from Anastasios) and i am Greek.

Posted

I hope this is what you wanted; CF isn't too elegant (could do with a helper CF for counter initialization),

but does the job.

EDIT: not quite …

Please do not Edit / Delete your Reply once they have been replied to. Whether or not it was a correct answer, doesn't matter, it still helped to move the process along, and by removing it now, it leaves a hole in the thread.

Lee

  • Newbies
Posted

I am not quite sure what that means; it seems something very close to gematria. If so, have a look at the attached.

thank you it does the job fine

This topic is 4617 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.