Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If formula Help Post Reply Post New Topic
Author Message
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Topic: If formula Help
     Posted: 25 Aug 2010 at 11:19pm
Hello,
 
Can anyone help please?
 
I need to filter out certain codes from STOCKDYN.PRDGRP.
 
Product group values are always 2 characters.
 
eg; CA, CB, CC, CD, C1, C2, etc
 
 
I need all product groups that startwith  C,  H,  L &  M
 
but dont require CC or MA to MZ.
 
So far I have this formula:
 

if {STOCKDYN.PRDGRP} in ["CC"] then FALSE else
left({STOCKDYN.PRDGRP},1) = ["C", "H", "L", "M0", "M1", "M2", "M3", "M4", "M5", "M6", "M7", "M8", "M9"]
 
I think the issue im having here is the LEFT,1 formula.
 
Can i amend the code to read:
 
left({STOCKDYN.PRDGRP},2) = ["C@", "H@", "L@", "M0", "M1" etc... ?
 
 
 
I know '@' refers to ANY CHARACTER in SQL commands and wondered if it was the same in Crystal reports. if not, what is an ANY CHARACTER symbol in crystal Reports?
 
or can anyone suggest a really easy way to do this?
 
 
 
Thanks in Advance.
 
Regards,

Michael Jones
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 26 Aug 2010 at 1:54am
you can use:

left({tbl.field},1) in ['C', 'H', 'L', 'M']
and
not ({tbl.field} in ['CC', 'MA', 'MZ']


hope it help.

Emir W
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Aug 2010 at 4:00am
as an FYI you can use LIKE with ? for single character replacement or * for multi character replacement.
Sample:
left({STOCKDYN.PRDGRP},2) LIKE ["C?", "H?", "L?", "M0", "M1"]
or
{STOCKDYN.PRDGRP} LIKE ["C*", "H*", "L*", "M0*", "M1*"]
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum