COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Calculation Field Help

• Email
• Follow

```I have a calculation field that is suppose to search for a string within a
field, and assign a value if it finds it, otherwise assign another value.

CMycalField =
If (AdOrder = "*trk*", 2, 1)

Where the result is a number.
I was hoping to find the letters "trk" somewhere in the field and if found
assign 2 to CMycalField, if not assign 1. It assigns everything 1.

Can someone help clarify this for me

Thanks

```
 0
Reply Henry 8/4/2003 10:19:29 PM

See related articles to this posting

```Henry <henry_filemaker@hotmail.com> wrote:

> I have a calculation field that is suppose to search for a string within a
> field, and assign a value if it finds it, otherwise assign another value.
>
> CMycalField =
> If (AdOrder = "*trk*", 2, 1)
>
> Where the result is a number.
> I was hoping to find the letters "trk" somewhere in the field and if found
> assign 2 to CMycalField, if not assign 1. It assigns everything 1.
>
> Can someone help clarify this for me

If(Patterncount(Fieldname, "trk") = 1, 2, 1)

--
Lynn Allen              Allen & Allen Semiotics
FSA Associate           Filemaker Consulting & Training
lynn@semiotics.com      http://www.semiotics.com
```
 0
Reply lynn 8/4/2003 10:29:56 PM

```Lynn allen <lynn@NOT-semiotics.com> wrote:

> Henry <henry_filemaker@hotmail.com> wrote:
>
> > I have a calculation field that is suppose to search for a string within a
> > field, and assign a value if it finds it, otherwise assign another value.
> >
> > CMycalField =
> > If (AdOrder = "*trk*", 2, 1)
> >
> > Where the result is a number.
> > I was hoping to find the letters "trk" somewhere in the field and if found
> > assign 2 to CMycalField, if not assign 1. It assigns everything 1.
> >
> > Can someone help clarify this for me
>
> If(Patterncount(Fieldname, "trk") = 1, 2, 1)

What if there are multiple occurrences of the string "trk"?
If(PatternCount(Fieldname, "trk"), 2, 1)

--
Henk B
```
 0
Reply henk 8/4/2003 10:48:22 PM

2 Replies
214 Views

Similar Articles

12/7/2013 12:27:15 AM
page loaded in 38884 ms. (0)