Jump to content

A Calculation Lesson Please


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

Recommended Posts

ok. I'm tired of messin with this stuff. I don't understand when I can inside calculatons, replace a 'field surrounded by a different function' for a field requirement. please help me understand how it works. Ive been trying to understand this one for three days. It's the last thing I need to do to split some data and I just don't understand it. It seems so simple.

I have a field (FIELD) text which looks like:

LSSHMAILING11212002

I need to remove the first four letters from the left and just leave the rest of the field okay. The first four letters will all be different. I thought ok start from position 5 from the left and take everything to the right of that so I figured I'd need:

Left ( text , number )

and inside that in place of the text, identify the 'changed field' (changed by the position starting at 5) and where to start and how much should be huge like 999 (I read that) laugh.gif

So I pasted the above in the box and right below that placed position.

Position ( text , search

Link to comment
Share on other sites

Middle (text, start, size)

Middle(Field, 5, 999)

Or

Right(Field, Length(Field) - 4)

You were attacking from the wrong side basically.

Also, when you say Position (Field, Field, 5, 1).

You can't look for the entire field in itself, but start at the 5th position.

What is being looked for has to be after the start position, or you got nothin.

Link to comment
Share on other sites

Pete,

Chapter 6 (on complex calcs) in Chris Kubica's _The Book of FileMaker 6_ looks OK as a tutorial... it's the only one I happen to have. The book comes with a CD of example files -- although taking apart some of the sample files available here would certainly be a good start to digesting what calcs can do...

Link to comment
Share on other sites

Hi Pete,

The Right(field, n) function tells FileMaker to return n number of characters from the specified field content, starting from the right. If you have a field ("name") with the value of "John Caballero", Right(name, 1) will return "o". Right(name,5) = "llero"

The Length(field) function returns the number of characters (including spaces and whatnot) in the specified field. Length(name) = 14.

So Right(name, Length(name)-4) is the same thing as Right(name,10). If the length of my "name" field for every record was always 14 and would never change, then I could, and probably would, just use Right(name, 10)...but how often is it the case that the contents of a field are the same number of characters in every record of a database?

Given that your field contents may not always be the same length, it's better to keep things as dynamic as possible - that's why Fenton and I both suggested Right(field, Length(field)-4). The only hard-coded variable is 4 which is the number of characters you said you needed to have stripped from the source field.

Link to comment
Share on other sites

This topic is 6594 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
 Share

×
×
  • Create New...

Important Information

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