Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: how to bring and at the end of the series Post Reply Post New Topic
Author Message
jason stratom
Newbie
Newbie


Joined: 17 Feb 2011
Location: India
Online Status: Offline
Posts: 21
Quote jason stratom Replybullet Topic: how to bring and at the end of the series
    Posted: 13 Mar 2011 at 7:17pm
Hi all,

How to bring an "and" at the end of a series.

Ex.1,2,3,4,5,6 and 7

Actually i brought comma between the numbers in a series .output 1,2,3,4,5,6,7
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 14 Mar 2011 at 3:44am
What is your input? An array of numbers? A string of numbers separated by a common delimiter?

Whatever the case is, let us suppose you manage to get an array of numbers represented by strings

ie: ["1", "2", "3"] (if they're not strings, you will have to convert them to string when you're concatenating them)


local stringvar array myList := {whatever input};
local stringvar outList := '';
local numbervar tempLen := count(myList)
local numbervar i;
for i := 1 to tempLen - 1 Do
   outList := outList & myList & ","
outList := outList & "and " & myList[tempLen]


So given n numbers, you would concatenate your first n - 1 numbers together each followed by a comma + space, and you would treat your last number differently with a preceding "and"

Edited by Keikoku - 14 Mar 2011 at 3:45am
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.