Jump to content

A newbie needs help

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

Recommended Posts

  • Newbies


I havent using filemaker scripts and I have stumbled to situation where a good script would do a trick.

Problem is with contents of field. I have to underline first name. Names with underlining uses 'pointers'

example: <u>Johnny<p> and it should become underlined without those 'pointers'

I am really a beginner with this Filemaker and Im open to all suggestions how Id get solved that problem.

Link to comment
Share on other sites

This is a trickier problem than it looks. I had a similar situation with a text field containing italicized portions. My data had html italic tags, as <I>italic</I>. I wanted to delete the tags and italicize the portion inbetween. What I had to do was figure out which record had the biggest number of italicized passages (13!). then I had to make separate calculation fields for each chunk. Using your example, if your field contained: "example: <u>Johnny<p> and it " I'd make three calc fields;

Text1 = example:

Text2 = Johnny

Text3 = and it

You do this by using the position & length functions to hunt for the first occurance of <u> and going to the first occurance of <p>, thus selecting the data inbetween.

Now take your text fields, make Text2 into an underline format, then put them together as merge fields on your display layout;


This will print correctly, as well.

This is a clumsy way of doing this job, and the calculations of your text fields can get pretty tricky, but it works. If nobody else comes up with a more elegant solution, and you still need the help, post again and I'll give you examples of my calculations.

Steve Brown

Link to comment
Share on other sites

  • Newbies

First of all thanks to you spb.

I really appreciate that you are helping me, but like I said Im really a beginner. I have some kind idea now, but those calculation examples would help me even more.

thank you in advance.

-I forgot to mention that field contains only full names:

<u>Johnny<p> Smith

and Im using windows.

Link to comment
Share on other sites


If you field only contains full names, and you only want to see the first name underlined, then the field will always begin with <u>, right? A name could have a title, like Dr. <u>Johnny<p> Smith, so <u> wouldn't always begin the field, unless you want to underline "Dr." as well.

Does your field contain only one name per record? If so, it will be a lot simpler.

If the field contains only one name, and if the field will always begin with <u>, then you need to make two calculation fields, let's call them FirstName and LastName (LastName will hold everything after the <p>, including middle names and initials. I will call your original field Name, and this will be the field referred to in the calculations. When you are defining the calculation fields, make sure you set the result to be "text."

FirstName = Middle( Name, Position(Name, "<u>" , 1 , 1) + 3, (Position(Name, "<u>" , 1 , 1) + 3 - (Position( Name, "<u>" , 1, 1 ) -1))

Using the Middle function, you are going into Name and selecting a spot three characters after the first occurance of "<u>":

Position(Name, "<u>" , 1 , 1) + 3

Then, to tell FM how many characters to choose from this point, you use a point defined as the number of characters from the beginning to four characters back from <p>B)

Position(Name, "<u>" , 1 , 1) + 3

minus the number of characters from the beginning to the first character after <u>B)

(Position( Name, "<u>" , 1, 1 ) -1)

This will give you the number of characters between <u> and <p> and the Middle function will fill the calculation field with the characters between your two tags.

The LastName field is easier:

LastName = Right(Name, (Length(Name) - Position(Name, "<p>", 0, 1) - 2))

Using the Right function, you are counting from the right a number of characters defined as the number of total characters in the Name field:


minus the number of characters up to <p>, filling the field with the last name.

On your layout, you insert the calculation fields as merge fields:


Now select <<FirstName>> and choose underline as a text attribute. Go back to browse made and you will see the name Johnny Smith displayed, and Johnny is underlined.

If there is more than one name in the Name field, the same process will work, but you will need more calculation fields. Think of the text in Name as being broken into groups;

Underlined - Not Underlined - Underlined - Not Underlined (etc.)

You need a text calculation field for each group, and the calculations get more tricky, as you will need to look for the *second* ossurance of "<u>" and so forth.

Steve Brown

Link to comment
Share on other sites

  • Newbies

Thanks Steve!

It works like a charm.

You saved my day.

I really appreciate that here almost everyone gets help and even newbies (like me) have a chance to learn this filemaker with the best advices.


Link to comment
Share on other sites

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