Technical Questions
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008, 2011 : Technical Questions
Message Icon Topic: Contains Syntax Post Reply Post New Topic
Author Message
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Topic: Contains Syntax
    Posted: 14 Jul 2008 at 5:02pm
Ok... I'm trying to build a contains syntax into the report using the edit selection formula for the record.  However, I don't know formulas very well, how do I create a syntax for 'CONTAINS' I want to be able to show only records that 'contain' (lets say) GAL in the description.  How can I go about this?
 
What I really want is to create a parameter where users can select those values (i.e. GAL, 1/20, etc...) from a selection list, however the formula behind it is to do the contains from the description.  I'm not sure that this can be done, but I'm pretty sure the first method can.
 
Thanks to everyone!
 
Luis
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 15 Jul 2008 at 1:33am
Hey....
 
Can you post some sample data for GAL 1/20.....
 
Cheers
Rahul
IP IP Logged
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Posted: 15 Jul 2008 at 9:03am

Hi Raul,

Attached is some samples of data of how they are recording info here at the company.  If we had a user defined field where they could had recorded this info, it would had been a lot easier....  anyhow, here you go!

-------------------------------------------------------------------------------
    ITEM NUMBER              DESCRIPTION
-------------------------------------------------------------------------------
     001-052                      1 SYNPOWER FUEL SYSTEM TREATME
     001-060                      1 EA RAIN REPELLENT CONCENTRAT
     001-091                      1/6 VAL SYNPOWER FST - 16OZ  
     001-123                      1/55 VAL AC 5w30             
     001-124                      1/55 VAL AC 10w30            
     001-129                      1/12 VAL AC 10w30            
     001-130                      1/55 VAL AC-20w50            
     001-135                      1/12 VAL AC 20w50            
     001-136                      1/55 VAL AC-10w40            
     001-140                      1/4 VAL AC 10w40             
     001-141                      1/12 VAL AC 10w40            
     001-149                      1/12 VAL MAX LIFE 10w30      
     001-150                      1/12 VAL MAX LIFE 10w40      
     001-154                      1/55 VAL HPO 30              
     001-155                      1/12 VAL MAX LIFE 5w30       
     001-159                      1/12 VAL HPO 30              
     001-161                      1/12 VAL MAX LIFE 20w50      
     001-165                      1/12 VAL HPO 40              
     001-171                      1/12 VAL HPO 50              
     001-177                      1/12 VAL AC 5w30             
     001-205                      1/12 VAL RAC 10w30
     99-TNK-1000DW          1000 GAL. UL DOUBLE WALL TANK
     99-TNK-1000SW          1000 GAL. SINGLE WALL TANK   
     99-TNK-1000SWUS      1000 GAL. SINGLE WALL TANK USE
     99-TNK-120AIR            120 GALLON AIRBOY            
     99-TNK-120AIRU          120 GALLON USED  AIRBOY      
     99-TNK-120DW            120 GAL DOUBLE WALL TANK     
     99-TNK-120DWUSE      120 GAL DOUBLE WALL TANK USED
     99-TNK-120SW             120 GAL SINGLE WALL TANK     
     99-TNK-120SWUSE       120 GAL SINGLE WALL TANK USED
     99-TNK-140SW             140 GAL SINGLE WALL TANK     
     99-TNK-170AIR             170 GALLON AIRBOY            
     99-TNK-185SW             185 GAL SINGLE WALL TANK     
     99-TNK-185SWUSE      185 GAL SINGLE WALL TANK USED
     99-TNK-240DULU         240 GAL DOUBLE WALL UL TANK US
     99-TNK-240DW            240 GAL DOUBLE WALL TANK     
     99-TNK-240DWUSE      240 GAL DOUBLE WALL TANK USED
     99-TNK-240SPLIT         240 GAL SPLIT 120/120 SINGLE W
     99-TNK-240SW             240 GAL SINGLE WALL TANK         
 
Basically, I want to get everything that only contains GAL in the description field, and then get everything that contains 1/12, then 1/55, and so on....
 
Let me know?
 
Thanks,
 
 
Luis
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 15 Jul 2008 at 2:57pm

Hi

Create 3 formulas IF else is used as some records will return 0 for INSTR as not all description has GAL. 1/12, 1/55
 
frm1 is it GAL. or Just GAL if just GAL then check for GALLON
 
IF INSTR({File_.Description},'GAL.') = 0 THEN
'NO'
ELSE
LEFT(Mid({File_.Description},instr({File_.Description},'GAL.')),4)
--------------------------------------------------------------------------------------
frm2
IF INSTR({File_.Description},'1/12') = 0 THEN
'NO'
ELSE
LEFT(Mid({File_.Description},instr({File_.Description},'1/12')),4)
 
--------------------------------------------------------------------------------------------
frm3
IF INSTR({File_.Description},'1/55') = 0 THEN
'NO'
ELSE
LEFT(Mid({File_.Description},instr({File_.Description},'1/55')),4)
 
 
 
Create parameters where user will enter the values check against the formula .....
 
{@frm1}={?TEST} and so on.....
 
Cheers
Rahul
IP IP Logged
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Posted: 15 Jul 2008 at 3:47pm
Ok, So this is what I did based on what you wrote Rahul:
 
IF INSTR({IM1_InventoryMasterfile.ItemDescription},'GAL') = 0 THEN
'NO'
ELSE
LEFT(Mid({IM1_InventoryMasterfile.ItemDescription},instr({IM1_InventoryMasterfile.ItemDescription},'GAL')),4)
 
However, I get an error when testing the formula:
The results of selection formula must be a boolean.
 
What does this mean?  BTW: as for the Gallons it is GAL w/o the period.
 
Thanks,
 
Luis


Edited by RiosLA - 15 Jul 2008 at 3:49pm
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 16 Jul 2008 at 2:46am

Hi

Where have you placed the formula..... you need to create the formula  separately and check with the parameter in record selection  formula
 
{@frm1}={?TEST} and so on.....
 
What crystal is trying to do is check if the result it true or false....
 
cheers
Rahul


Edited by rahulwalawalkar - 16 Jul 2008 at 2:46am
IP IP Logged
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Posted: 16 Jul 2008 at 11:08am
ok, that worked... I was inserting the formula in the record selection formula editor.  After reading your message better I did just as you mentioned and it worked.
 
Now, as for the other formulas for the other products, do I  create a formula for each product and then how do I tell the parameter to look in each of those formulas?
 
Thanks,
 
 
Luis
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 18 Jul 2008 at 4:19am

Hi,

If you read the post above their are 3 separate formulas which you will need to create and check them as you are checking the first one....

Now the question is do you want the records which satisfy what you have selected then use and condition or use or.....

cheers

Rahul
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.063 seconds.

FREE ADVANCED
Crystal Reports Training!

Plus, free bonus PDF cheat sheet! Advanced Crystal Reports Training Give Me Advanced Training!