Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: categorizing data Post Reply Post New Topic
Author Message
KimV
Newbie
Newbie
Avatar

Joined: 01 Jan 2011
Location: United States
Online Status: Offline
Posts: 1
Quote KimV Replybullet Topic: categorizing data
     Posted: 01 Jan 2011 at 10:59pm

Hi all. I apologize for the lack of sophistication. I'm still new to this program. I'd greatly appreciate any assistance.

I'm working with Crystal XI.
 
I have a report searching through text fields of records for specific strings. Each record has multiple text fields.  I used a formula and set up an IF/THEN/ELSE statement like this:
 
IF {Record.textfield} LIKE "1st_thing" THEN "Group A" ELSE
IF {Record.textfield} LIKE "2nd_thing" THEN "Group B" ELSE
Group C
 
It is possible for the first textfield of a particular record to contain the string "1st_thing" and the second textfield to contain the string "2nd_thing", thus falling into both categories. So, I want to prioritize. I want the report to search all the textfields for the first condition. If found, move to the next record. If not found, it should search for the second condition. If the report finds neither condition, then the record would default to "Group C".
 
My report is finding the conditions, but it's also duplicating records in each Group. How do I avoid duplication?
 
Any guidance?
Thanks again.


Edited by KimV - 01 Jan 2011 at 11:02pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Jan 2011 at 3:40am

Let's see, there are multiple records for an item, and each can have a textfield that is being used for grouping, and you want to uniquely group the records based on the textfield.

If you are getting the values from a stored proc, it isn't too hard. If you are joining directly to the tables, I am not sure how to accomplish it.  You can group by the identifer for all the records, and then using a sort assign a group, but that is probably not what you are after.
 
The other idea is to use the formula that you have now, create a string variable and append to it as you display each group, checking if the identifier is not already in the variable.  If you are doing any aggregates you would need to either code them or create running totals (DBlank's forte). 
 
The basis of this filtering would be:
in the detail section (probably), suppression formula in Section Expert
shared stringvar alreadyDisplayed;
local booleanvar display := true;
 
if INSTR(alreadyDisplayed, "|" + {table.uniqueID} + "|") > 0 Then
  display := false;
else
  alreadyDisplayed := alreadyDisplayed + "|" + {table.uniqueID} + "|";
 
display
 
 
HTH
 
 
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