Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Combining results from one field onto one line Post Reply Post New Topic
Author Message
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Online Status: Offline
Posts: 13
Quote HSD89 Replybullet Topic: Combining results from one field onto one line
    Posted: 21 Jan 2013 at 6:07am
Good afternoon all! been some time since ive posted on here and in need of some help
 
im developing a report which uses information from a reference number and displays multiple flags for each ref. Ive managed to use the Select Expert to narrow down the results i want but they appear in a line for example
 
**/*****/****      GSI
                            TFL
                            AND
                            
 
id like to have it in the following format
 
**/*****/**** GSI, TFL, AND
 
ive tried creating a formula that says "if {**} in ["GSI", "TFL", "AND"] then "GSI, TFL, AND" else "whatever" but that doesnt seem to do the trick. does anyone else have any ideas?
 
any help is much appreciated!!


Edited by HSD89 - 21 Jan 2013 at 6:13am
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 22 Jan 2013 at 2:31am
Hi

I hope you have a group on reference number, if not create a group on reference number and create the following formulas :

Formula1  // place this formula on your reference group header

Whileprintingrecords;
Stringvar falg:=" ";


Formula2 // Place this on your detail or where GSI,TFL etc are printing

Whileprintingrecords;
Stringavar flag:=flag+','+{Flag_datafield};

Formula 3  // place this on your group footer

Whileprintingrecords;
Stringvar falg;

On group footer it will display all flags with side by side and you can suppress detail and group header if not required.






Thanks,
Sastry
IP IP Logged
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Online Status: Offline
Posts: 13
Quote HSD89 Replybullet Posted: 23 Jan 2013 at 12:44am
Sastry
 
thank you so much for your swift response! Its turns out your set of forumlas have got me about 50% of the way there. Ive noticed after creating that report it was coming across with a number of the same flags for example
 
"GSI, TFL, AND,"
"GSI, TFL, AND, GSI"
"GSI, TFL, AND, GSI, TFL" etc
 
so i adapted formula2 slightly to state this:-
 
Whileprintingrecords;
if {Category.Flag} = Next ({Category.Flag}) then " " else
Stringvar flag:= {Category.Flag}+','+ next({Category.Flag})

seems to sort of do the trick. but the problem is, some references only contract one flag and it doesnt seem to be picking that up. In other words, if one reference just has "AND" then i want it to show "AND" but if a reference has "AND" and "GSI" i want it to show "AND + GSI" if that makes sense?
 
thanks again for your help!!
IP IP Logged
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Online Status: Offline
Posts: 13
Quote HSD89 Replybullet Posted: 27 Jan 2013 at 10:43pm
bump?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jan 2013 at 5:06am
instead of using NEXT() as your check to include or exclude use instr()
something like:
 
Whileprintingrecords;
Stringvar flag:= flag + (if instr(Stringvar flag,{Category.Flag}) > 0 then "" lse {Category.Flag} + ',')
IP IP Logged
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Online Status: Offline
Posts: 13
Quote HSD89 Replybullet Posted: 29 Jan 2013 at 5:39am
Absolutley amazing! Thank you DBlank, youve saved my brain from major swelling!!
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.016 seconds.