Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Negating IN function generates error - missing THEN

Status
Not open for further replies.

bjplayer

Programmer
May 14, 2002
11
US
This formula compiles OK:

If {field_name} In [3,5,8,13] Then ' '

The following forumula gets a "The Keyword THEN is missing" error:

If {field_name} Not In [3,5,8,13] Then ' '

The only change was to negate the condition. I know I have used this without problems in versions prior to 8.5.

Any ideas what is wrong with the latter formula?

Thanks.

 

I can't check this out on my machine at the minute, but I think you're right about this syntax being okay on v7.

Why don't you just turn your formula around?

If {field_name} In [3,5,8,13] Then {field_name} Else ' '

Naith
 
Dear BJPlayer:

I believe the correct syntax for that not operator with the if is as follows (note the statement being checked is enclosed in parens):

if not(If {field_name} In [3,5,8,13] Then '')then ""

Hope this is helpful,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Thanks for that suggestion. The formula I presented was part of a much longer formula, so the exact thing you suggested would not work, but it did make me think about rearranging the formula. When I did that, I did not even have to use "In."

bjplayer
 
Dear ALL:

I just noticed above that my formula is wrong, I would swear it didn't have the extra stuff when I posted but it does, so I must have done it :)

Here is the corrected one for future reference.

if not({field_name} In [3,5,8,13]) then " "

Sorry if my mistake caused you a loss of time.

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
if not(If {field_name} In [3,5,8,13] Then '') then ""
is almost right, Rosemary.

I found that:

if not ({field_name} IN [3,5,8,13]) Then
'blank'
else
{field_name]

works. Thanks.

bjplayer

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top