Jump to content

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

Recommended Posts

Posted

I am trying to make a field that will make the name of a student possessive so their name can be used in a possessive form automatically. Is there a way to make a formula/function that will look at the name of a student, see if the last letter of their name is

Posted

I assume you must be American if that's how you denote possessive form. smile.gif

Anyway, try this:

Name & Case(Right(Name,1)="s","'","'s")

and for all the rest of the world:

Name & "'s"

Posted

I'd Trim() the Name field's contents to get rid of any training spaces that may accidentally be entered.

Posted

First, I want to thank both of you for your time and the solution to my queston. This was my first post and your response was fast and wonderful Thank You!

Next, what is a good book to aid in learning tricks like the one above? I have "FileMaker Pro" by Nolan Hester, "FileMaker Pro Advanced" by Cynthia L. Baron/Daniel Peck and "Learn FileMaker Pro" by Jonathan Stars. These seem to be good books but they seem to lack detailed explaniations on how all formulas/functions are used.

Finally, the Trim() worked great on spaces but not returns. Is there a way to prevent an accidental return?

Again, thank you very much for your help!

Elgin Cook

Alaska, USA

Posted

Hi Elgin,

Welcome to the list. It appears that you have a good assortment of books, You might want to add one more called Special Edition Using FileMaker Pro 5, by Rich Coulombre and Jonathan Price. However, the best way to learn IMHO, is to get your hands on as many tip and trick, example, sample files, etc. that you can and then tear them appart to see what makes them tick. The second thing is to try and accomplish or make a sample file on what others on list(s), such as this, are asking, and then, compare your answer to what is given by others. The Third thing is, while you are developing solutions, do *NOT* hesitate to ask your questions here, and on the other FileMaker list that you belong to.

If you need it, I can give you a list of sites (including here) for example files, and a list of other FileMaker lists you can join.

Now to answer the question about the paragraph, Use the substitute step with the calculation:

Trim(Substitute(Name, "?", "") & Case(Right(Name,1)="s","'","'s")

)

HTH

Lee

cool.gif

Posted

I should have tried this calculation before posting, there is an error in it, so don't use.

Lee

;(

Posted

Hi Elgin,

I came up with this calculation, only problem is that it breaks if the name ends in "S" and the user puts in a paragraph. I'm still working on it, however, maybe someone else can come up with something better for you.

frown.gif

LeftWords(Trim(Name), WordCount(Trim(Name))) & Case(Right(Trim(Name),1)="s","'","'s")

HTH

Lee

Posted

To remove paragraphs use this function:

Substitute(textfield, "

Posted

Hi Vaughan,

I tried that first and it wouldn't work with when coupled with the Trim and Case functions.

Lee

Posted

Nope, tried that one too, and also breaks with the s ending names

;(

Posted

Hi Elgin smile.gif

You are wise to question how to remove those pesky carriage returns!! I highly suggest you strip them from your text fields (except for multikey fields) during data-entry as they will cause problems for you in many ways.

You can search for "Carriage Returns" on this Forum for a range of ideas on stopping them from being entered, and also how to strip them from your existing dBs. This Forum has been invaluable to me on this very issue.

If you would more help on this subject after researching on Forum, post a new question and we'll help you with it.

LaRetta

Posted

Here is the function that strips returns, trims spaces and adds the apostrophe:


Trim(Substitute(textfield, "

Posted

As a matter of interest (and at the risk of gilding Vaughan's lily), I'd make the following observations:

1. Nesting Substitute and Trim is redundant - the effect of both can be achieved simultaneously with the Xwords functions.

2. The use of Lower( ) is redundant, since boolean tests are not case sensitive.

Thus a more compact expression which will achieve the desired outcome is:

LeftWords(YourText, 99) & Left("'s", 2 - (Right(LeftWords(YourText, 99), 1) = "s"))

The use of Left( ) rather than If( ) or Case( ) for the closing statement is, admittedly, purely arbitrary... wink.gif

Posted

Hi Ray,

I don't know how you can imagine such calculations tongue.gif , starting with Left and Leftwords when we are looking to correct the Right part of the Name confused.gif . You may be a very complicated guy grin.gif!!! but it works great.

Your solution not only "trim" spaces and carriage return at the end of the text field entry but also every clipboard of type "

Posted

I hereby formally declare my lily well and truly gilded!

Posted

Hi Ray,

Very niice, so smoooooooooooooth.

At least I started out in the right direction using LeftWords.

Thanks for the calculation, I know I'll have a use someday for this one.

Lee

tongue.gif

Posted

Just a quick note to let all those who helped out in this. I truely appreciate it! I think I found the REAL place to learn. :-)

Elgin

This topic is 7999 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.