Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am trying to write a script that checks if one word is nearer the start of the field than 2 other words. I have tried the following but it doesn't seem to work

IF Position(Text,"XXX",1,1) < Position(Text,"YYY",1,1) or Position(Text,"XXX",1,1) < Position(Text,"ZZZ",1,1)

Set Field ......

End IF

It works fine if I am only comparing it to 1 word i.e. everything before the 'or' but does not want to work for multiple words

Any ideas?

Cheers

Nick

Posted

Your current formula syntax is ascertaining whether XXX is nearer to the start of the field than either one of the other words.

If you want to ensure that it is nearer than both the other words, you will have to use the and operator rather than or - thus:

If ["Position(Text,"XXX",1,1) < Position(Text,"YYY",1,1) and Position(Text,"XXX",1,1) < Position(Text,"ZZZ",1,1)"]

Posted

No, I am trying to ascertain whether the first word is in front of either of the other words as the field will contain either of the other words but unlikely to contain both

Posted

Thanks for clarifying. I think perhaps I have got a little closer to understanding what it is you are looking for.

Perhaps you would like to try:

Position(Text,"XXX",1,1) < Min(Case(Position(Text,"YYY",1,1), Position(Text,"YYY",1,1)), Case(Position(Text,"ZZZ",1,1),Position(Text,"ZZZ",1,1)))

I've tested it out in a file here (see copy attached to this message) and it appears to work for all cases.

XYZ.zip

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