Help with Middle ()

Help with Middle ()

am 26.11.2007 14:40:50 von notis.toufexis

I am stuck with this and I was hoping someone can give me a quick
hint:

I am trying to create a calculation field that will select only the
text marked with two different symbols (one for beginning one for end:
"trala la &datatzum bum bum# boom boom", I need only what is between &
and #) in a second field. I use Middle to determine where the function
should start but can not find a way to determine the number of
characters in between. It should be simple, but I am stuck.

Thanks in advance,
Notis

Re: Help with Middle ()

am 26.11.2007 15:09:22 von bill

In article
,
"notis.toufexis@gmail.com" wrote:

> I am stuck with this and I was hoping someone can give me a quick
> hint:
>
> I am trying to create a calculation field that will select only the
> text marked with two different symbols (one for beginning one for end:
> "trala la &datatzum bum bum# boom boom", I need only what is between &
> and #) in a second field. I use Middle to determine where the function
> should start but can not find a way to determine the number of
> characters in between. It should be simple, but I am stuck.
>
> Thanks in advance,
> Notis

You can use the Position() function to determine the position of each of
the boundary characters, then take the difference between these
positions for the number of characters.

Re: Help with Middle ()

am 26.11.2007 15:15:49 von Matt Wills

Use the Position function to locate the start and end characters.

Subtract the start from the end to get the length of the Middle function.

Something like...

Let [
Start = Position (YourText ; "&" ; 1 ; 1 ) +1;
End = Position (YourText ; "#" ; 1 ; 1 ) -1 ] ;

Middle ( YourText ; Start ; End - Start) )

Matt



on 11/26/07 8:40 AM notis.toufexis@gmail.com said:
> I am stuck with this and I was hoping someone can give me a quick
> hint:
>
> I am trying to create a calculation field that will select only the
> text marked with two different symbols (one for beginning one for end:
> "trala la &datatzum bum bum# boom boom", I need only what is between &
> and #) in a second field. I use Middle to determine where the function
> should start but can not find a way to determine the number of
> characters in between. It should be simple, but I am stuck.
>
> Thanks in advance,
> Notis

Re: Help with Middle ()

am 26.11.2007 19:15:48 von Chris Brown

notis.toufexis@gmail.com wrote:
> I am stuck with this and I was hoping someone can give me a quick
> hint:
>
> I am trying to create a calculation field that will select only the
> text marked with two different symbols (one for beginning one for end:
> "trala la &datatzum bum bum# boom boom", I need only what is between &
> and #) in a second field. I use Middle to determine where the function
> should start but can not find a way to determine the number of
> characters in between. It should be simple, but I am stuck.
>
> Thanks in advance,
> Notis


You could alo use a custom function, which would give downstream
versatility.




From the BrianDunning site, TweeText by Dan Neesley, NorthShore
Techworks, Returns all text between 2 text strings

TweenText ( BeginText ; EndText ):

Middle ( Text ;

Position ( Text ; BeginText; 1 ; 1 ) + Length(BeginText) ;

(Position ( Text ; EndText ; 1 ; 1 )) - (Position ( Text ; BeginText; 1
; 1 ) + Length(BeginText) +1 )

)



Sample Input:
[ShipName]Scott Brazil[/ShipName]

Sample Output:
Scott Brazil

Re: Help with Middle ()

am 27.11.2007 03:09:33 von squeed2000

These guys have already answered your question, but I'm going to
answer it in a different way. This is not hard to do, but it is a
confusing concept to get down. So I'm going to explain it in a way
that you can recreate so that you can figure it out by testing it.

Step 1. - Create a Filemaker database that has 2 fields. Name field
1 "Container" that should be a TEXT field and name field 2 "Result"
that should be a calculation.

Step 2. - The calculation for the Result field is :

Middle ( Container ; Position ( Container ; "&" ; 1 ; 1 ) + 1 ;
Position ( Container ; "#" ; 1 ; 1 ) - Position ( Container ; "&" ;
1 ; 1 ) - 1 )

Step 3. - Enter browse mode and great a new blank record. In the
Container field. Enter "&This is what is in the middle#" without the
quotes.

Step 4. - If you did everything right, the Result field should show
you "This is what is in the middle"

You should now be able to reverse engineer the formula above so that
you understand the concept and modify it for your application.

Let me know if this helps, because when I was asking these questions,
I got a lot of answers, but ones that while were the right ones, were
difficult to follow.

-S

Re: Help with Middle ()

am 27.11.2007 09:56:50 von ursus.kirk

> Step 1. - Create a Filemaker database that has 2 fields. Name field
> 1 "Container" that should be a TEXT field and name field 2 "Result"
> that should be a calculation.
>
> Step 2. - The calculation for the Result field is :


Squeed, I do appriciate your effort to help the OP. But to learn him a habit
by naming an object using a word already in existence is bad practice. You
should never name a field: container, script, variable, global, text,
number, etc, etc. If you realy must, then use MyContainer, MyScript. But
even this I wouldn't recommend.

Keep well, Ursus