Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Is not like query Post Reply Post New Topic
Author Message
adders
Groupie
Groupie


Joined: 09 Aug 2010
Online Status: Offline
Posts: 53
Quote adders Replybullet Topic: Is not like query
    Posted: 22 Sep 2011 at 10:33pm
I have around 300 part numbers I need to pull from a database, for example:

HIRK-433A
HIRK-433AQ1363

Is there away to not show parts with Q1363 or any Q number between 1 and 5000?

Also is there away of removing the decimal point when pulling out prices, in order to display in pence?

Thanks

Adam
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Sep 2011 at 3:41am
1) in the filter expression, I would try
local numbervar ind := instr({table.field}, "Q", 4);  //starts looking for Q after the 4th position (just in case)
local numbervar res;
if ind > 0 then (
  res := cint(mid({table.field}, i + 1));
  if res >= 1 and res <= 5000 then
    false
   else
     true;
)
else
  true
 
 
2) multiply the price by 100(or whatever valus is needed) in a formula and display the result
 
 
HTH
IP IP Logged
adders
Groupie
Groupie


Joined: 09 Aug 2010
Online Status: Offline
Posts: 53
Quote adders Replybullet Posted: 26 Sep 2011 at 10:54pm
Hi Lockwelle,

Unfortunately it seems to ask for a string at cint.

Just trying some basic code, where {table.field} like %Q1% but that wont even bring up any parts for example 008-433FQ1847

Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 27 Sep 2011 at 12:12pm
the Mid() returns a string...you can also do totext({table.field},0,"") to turn your number into a string if that is needed.
 
LIKE in the formulas uses * and ? for the wildcards, not %
...you can also use instr() for like...if the value >0 then it is 'like', not quite as robust...
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.