Wild Card/Generic retrieval
Deskin, Bob
Bob.Deskin@Cognos.COM
Wed, 10 Sep 2003 06:10:11 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C37783.B8B33800
Content-Type: text/plain
I don't know the details of the pattern matching algorithm, but generally it
is more CPU intensive compared to the other PowerHouse functions. I don't
know for a fact that that is universally true, however our advice over the
years has been to use pattern matching only when absolutely necessary. As an
example, there are many questions about looking for a particular character
that are answered by using INDEX rather than pattern matching.
To the specific case in point, I believe pattern matching works front to
back looking at each character. I would expect TRUNCATE to work back to
front. I.e. is the last character a space, if so, make the length of the
item equal to the length of the item minus one, and repeat until no space.
Once you've done that, the length of the item is less (if there were spaces)
and you have fewer characters to loop through.
The intent is to get out of the pattern matching routine as soon as possible
and keep it as simple as possible.
If you really wanted to avoid pattern matching in this case, I think the
following works as well:
If 0 = index(partno,"th") - size(truncate(part-no)) - 1
Bob Deskin
Product Manager, Application Development Tools
Cognos Inc. 3755 Riverside Drive, Ottawa ON K1G 4K9 CANADA
bob.deskin@cognos.com (613) 738-1338 ext 7268
-----Original Message-----
From: Chris Sharman [mailto:chris.sharman@ccagroup.co.uk]
Sent: September 10, 2003 4:09 AM
To: Deskin, Bob
Cc: powerh-l@lists.swau.edu
Subject: Re: Wild Card/Generic retrieval
Deskin, Bob wrote:
>
> SELECT IF MATCHPATTERN(TRUNCATE(partno),"@th")
>
> The TRUNCATE removes trailing spaces, otherwise you'd have to match them.
I would have used the simpler 'matchpattern(partno,"@th *")' - is the
truncate more efficient ?
Chris
-----------------------------------------------------------------------
Any views expressed in this message are those of the sender and not
necessarily those of CCA Group. The unauthorized use, disclosure,
copying or alteration of this message is forbidden. The contents of
this message may be confidential and/or privileged, copyright CCA Group
and are intended solely for the use of the individual or entity to whom
they are addressed. Whilst this message has been scanned, CCA Group
cannot guarantee that it is virus free or compatible with your systems
and accepts no responsibility for any loss or damage arising from its
use. The recipient is advised to run their own anti-virus software. If
you receive this message in error please contact
postmaster@ccagroup.co.uk immediately, destroy any copies and delete it
from your computer systems.
Join us at Cognos' biggest event of the year Enterprise 2003, The Cognos
Business Forum. Taking place in over 25 cities around the world, it's an
opportunity for Business and IT leaders to learn about strategies for
driving performance. Visit http://www.cognos.com/enterprise03 for more
details.
This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so. Thank you.
------_=_NextPart_001_01C37783.B8B33800
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2654.89">
<TITLE>RE: Wild Card/Generic retrieval</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>I don't know the details of the pattern matching =
algorithm, but generally it is more CPU intensive compared to the other =
PowerHouse functions. I don't know for a fact that that is universally =
true, however our advice over the years has been to use pattern =
matching only when absolutely necessary. As an example, there are many =
questions about looking for a particular character that are answered by =
using INDEX rather than pattern matching.</FONT></P>
<P><FONT SIZE=3D2>To the specific case in point, I believe pattern =
matching works front to back looking at each character. I would expect =
TRUNCATE to work back to front. I.e. is the last character a space, if =
so, make the length of the item equal to the length of the item minus =
one, and repeat until no space. Once you've done that, the length of =
the item is less (if there were spaces) and you have fewer characters =
to loop through.</FONT></P>
<P><FONT SIZE=3D2>The intent is to get out of the pattern matching =
routine as soon as possible and keep it as simple as possible.</FONT>
</P>
<P><FONT SIZE=3D2>If you really wanted to avoid pattern matching in =
this case, I think the following works as well:</FONT>
</P>
<P><FONT SIZE=3D2>If 0 =3D index(partno,"th") - =
size(truncate(part-no)) - 1</FONT>
</P>
<P><FONT SIZE=3D2>Bob =
Deskin =
</FONT>
<BR><FONT SIZE=3D2>Product Manager, Application Development =
Tools</FONT>
<BR><FONT SIZE=3D2>Cognos Inc. 3755 Riverside Drive, Ottawa ON K1G 4K9 =
CANADA</FONT>
<BR><FONT SIZE=3D2>bob.deskin@cognos.com (613) 738-1338 ext 7268</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Chris Sharman [<A =
HREF=3D"mailto:chris.sharman@ccagroup.co.uk">mailto:chris.sharman@ccagro=
up.co.uk</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: September 10, 2003 4:09 AM</FONT>
<BR><FONT SIZE=3D2>To: Deskin, Bob</FONT>
<BR><FONT SIZE=3D2>Cc: powerh-l@lists.swau.edu</FONT>
<BR><FONT SIZE=3D2>Subject: Re: Wild Card/Generic retrieval</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Deskin, Bob wrote:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> SELECT IF =
MATCHPATTERN(TRUNCATE(partno),"@th")</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> The TRUNCATE removes trailing spaces, otherwise =
you'd have to match them.</FONT>
</P>
<P><FONT SIZE=3D2>I would have used the simpler =
'matchpattern(partno,"@th *")' - is the </FONT>
<BR><FONT SIZE=3D2>truncate more efficient ?</FONT>
</P>
<P><FONT SIZE=3D2>Chris</FONT>
</P>
<BR>
<BR>
<P><FONT =
SIZE=3D2>---------------------------------------------------------------=
--------</FONT>
</P>
<P><FONT SIZE=3D2>Any views expressed in this message are those of the =
sender and not</FONT>
<BR><FONT SIZE=3D2>necessarily those of CCA Group. The =
unauthorized use, disclosure,</FONT>
<BR><FONT SIZE=3D2>copying or alteration of this message is =
forbidden. The contents of</FONT>
<BR><FONT SIZE=3D2>this message may be confidential and/or privileged, =
copyright CCA Group</FONT>
<BR><FONT SIZE=3D2>and are intended solely for the use of the =
individual or entity to whom</FONT>
<BR><FONT SIZE=3D2>they are addressed. Whilst this message has =
been scanned, CCA Group</FONT>
<BR><FONT SIZE=3D2>cannot guarantee that it is virus free or compatible =
with your systems</FONT>
<BR><FONT SIZE=3D2>and accepts no responsibility for any loss or damage =
arising from its</FONT>
<BR><FONT SIZE=3D2>use. The recipient is advised to run their own =
anti-virus software. If</FONT>
<BR><FONT SIZE=3D2>you receive this message in error please contact</FON=
T>
<BR><FONT SIZE=3D2>postmaster@ccagroup.co.uk immediately, destroy any =
copies and delete it</FONT>
<BR><FONT SIZE=3D2>from your computer systems.</FONT>
</P>
<P><FONT SIZE=3D2>Join us at Cognos' biggest event of the year<I> =
Enterprise 2003, The Cognos Business Forum</I>. Taking place in =
over 25 cities around the world, it's an opportunity for Business and =
IT leaders to learn about strategies for driving performance. Visit<U> =
<A HREF=3D"http://www.cognos.com/enterprise03" =
TARGET=3D"_blank">http://www.cognos.com/enterprise03</A></U> for more =
details. </FONT></P>
<P><FONT SIZE=3D2>This message may contain privileged and/or =
confidential information. If you have received this e-mail in =
error or are not the intended recipient, you may not use, copy, =
disseminate or distribute it; do not open any attachments, delete it =
immediately from your system and notify the sender promptly by e-mail =
that you have done so. Thank you.</FONT></P>
</BODY>
</HTML>
------_=_NextPart_001_01C37783.B8B33800--