cancel
Showing results for 
Search instead for 
Did you mean: 

How to display half of the records on left and another on the right side

Former Member
0 Kudos
1,219

Hi All

I am working on a crystal report in which we need to display the data in such away that half of the records on the left and another half on the right.

as shown below

I am having the data like this with 3 columns.

*Name     TimeShift    Schedule*     

Ashok    10.00-11.00   Football
Ashok1   09.00-11.00  Football
Ashok2   10.30-11.00  Cricket
Ashok3   10.00-11.30  Football
Ashok4   10.00-11.00  Football
Ashok5   10.00-11.00  Football
Ashok6   10.00-11.00  Baseball
Ashok7   10.00-11.00  Football
Ashok8   10.00-11.00  Football

Total 9 records I have. But I need to display

1st record on the left

2nd on the right

3rd on the left

4th on the right.......

Final Output should be like this.

*Name     TimeShift   Schedule       Name     TimeShift   Schedule* 
Ashok    10.00-11.00  Football       Ashok1   09.00-11.00  Football
Ashok2   10.30-11.00  Cricket        Ashok3   10.00-11.30  Football
Ashok4   10.00-11.00  Football       Ashok5   10.00-11.00  Football
Ashok6   10.00-11.00  Baseball       Ashok7   10.00-11.00  Football
Ashok8   10.00-11.00  Football

Appreciated ur help in advance.

Thanks.

Ashok

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Why not use Format wiith Multiple Columns (in the section expert for the Details section) then you can set the width of the few columns you're displaying and the space between.

Be sure to set it to "Across then Down"

Edited by: Crystalier on Aug 7, 2008 4:20 PM

Former Member
0 Kudos

Much easier Crystalier, but the field headings do not follow the new columns. Is there a fix for that, or should I add text boxes?

Former Member
0 Kudos

Just use static text boxes and you can conditionally suppress them based on number of records in case you don't need the headings (text objects) for all the columns.

Former Member
0 Kudos

Crystalier... can you get me pointed in the right direction? I am affraid I don't know what you mean, by Static Text Boxes

Former Member
0 Kudos

Insert | Text Object

Type in your column headings and drag them into the page (or group) header so that they line up with your columns.

Former Member
0 Kudos

Thanks. I had that. I think I was looking for the text boxes to just copy over to the next row on their own. I understand I will need to make a Text box (heading) for each column, then suppress. Can you help me out with the suppression formula? I assume it is not a simple isnull statement.

Former Member
0 Kudos

I figured it out.

I determined how many records would fit in the first column (31) then used the Insert Summary to count number of Item numbers and placed in the report footer. I used a suppression formula of ......Count ({F4102.IBLITM}) < 32.

Thanks for all your help Crystalier.

Former Member
0 Kudos

Ashok,

Here is one way to do it:

1) Place "Name" in the details section.

2) Insert a Running Total... Count to create row numbers

3) Create the following formulas:


c1_Name = IF INT({#RTotal0} / 2) * 2 != {#RTotal0} THEN {Table.Name}

c2_Name = IF INT({#RTotal0} / 2) * 2 != {#RTotal0} THEN NEXT({Table.Name})

4) In Design View, right click to the left of the report, in the details area... choose Section Expert.

5) Make sure Details is highlighted. Click the X-2 button next to Suppress (No Drill down)

6) Enter the following formula:


IF {@c1_OrderID} = 0 THEN TRUE ELSE FALSE

7) Repeat step 3 for TimeShift and again for Schedule.

The end result... Odd number rows end up in the left columns and evens on the right.

Hope this does the trick for you,

Jason

Former Member
0 Kudos

Jason

I was in need of something like this too. I have tried your solution, but my 1st part number ( row 1) does not show in either formula (your #3). I assume I was supposed to place each formula in the details section.

Did I miss something?

here is the formulas I used based off your suggestions.... 1 called test the other test 2

test

IF INT({#RTotal0} / 2) * 2 = {#RTotal0} THEN {F4102.IBLITM}

test 2

IF INT({#RTotal0} / 2) * 2 = {#RTotal0} THEN NEXT({F4102.IBLITM})

I used this for my suppression formula

IF {@test} = "0" THEN TRUE ELSE FALSE // I added the " " because it was asking for a string

Did I follow your direction?

Former Member
0 Kudos

Travis,

The key here is that you have the row numbers. Were you able to get that?

Once you have that you can use the two formulas.


test
IF INT({#RTotal0} / 2) * 2 = {#RTotal0} THEN {F4102.IBLITM}

test 2
IF INT({#RTotal0} / 2) * 2 = {#RTotal0} THEN NEXT({F4102.IBLITM})

The formula is simply testing to see if {#RTotal0} is odd or even... Odd needs to be TRUE... Even Needs to be False.

Please be a ware:

1) my != means not equal, you used = which is equal. The reason I used != is because the angle brackets (which you'll actually want to use) don't show up in the posts on this sight... (Can we PLEASE get this fixed!!!)

... Why it matters... It keeps the odd's on the left and the even's on the right AND it keeps you from loosing the 1st record.

2) You may need to change the "{#RTotal0}" if your running total column has a different name (I just went with the CR default).

Once you have the fields in the Details section, the data in the new columns should look something like this:


Name                Name

Name                Name

Name                Name

... with spaces in between...

The suppression formula needs to be changed for text (when I tested this last night I used a number value instead of text... sorry).

Try this:


IF {@Test} = "" THEN TRUE ELSE FALSE

See if it works now.

Jason

Former Member
0 Kudos

Hi Jason Thanks for ur reply.

In the reply u have given the suppression forumla as

IF {@c1_OrderID} = 0 THEN TRUE ELSE FALSE

what's this {@c1_OrderID} formula contains.

If I am right it should be #Rtotal0, if not please correct me.

One more thing if I am having only one record then it is displaying the same on both sides.(left and right). How to correct this.

Except that I got my answer.

Once again thanks.

Former Member
0 Kudos

Ashok,

That suppression formula is correct... well almost. It should be:


IF {@c1_OrderID} = "" THEN TRUE ELSE FALSE

because you are working with a text field.

Check my 1st post in this thread to see what "{@c1_OrderID}" is for.

It essentially checks to see if a row number is odd or even and put odd numbers in the left column and even numbers in the right column.

Jason

Former Member
0 Kudos

Hi Jason,

I am little confused what is inside the {@c1_OrderID} formula.

Please help!

Thank you,

Ashok

Former Member
0 Kudos

Ashok,

Check your gmail account. I sent you an examle report.

Jason

Former Member
0 Kudos

Thanka Jason, I got the answer.

Appreciated ur help.

Former Member
0 Kudos

Hi Jason

As I'm almost done with the report, but there was a change request in the requirement.

They want to dipslay first half of the records on the left and another half on the right,not the alternative records on the left and and right side.

If they are 25 records, first half will be 13 and second half will be 12.

So they want the first 13 records on the left and next 12 on the right.

Can u please help me.

Thanks

-Ashok

Former Member
0 Kudos

Ashok,

To do this you would simply need a little modification.

First you would need to know your total number of records and divide by two...


HalfRowCount = RoundUp(Maximum(RecordNumber) / 2)

Then change your existing formulas to something like...


1st Column Set = IF RecordNumber <= {@HalfRowCount} THEN ...

2nd Column Set = IF RecordNumber > {@HalfRowCount} THEN ...

See how that works for you.

Jason

Former Member
0 Kudos

Thanks for ur reply Jason,

But its not displaying the records as I wish

Col1   Col2      Col3      Col1  Col2   Col3  RN0
A1      A2     A3                                   1
B1      B2     B3                                   2
C1      C2     C3                                   3
                               D1      D2     D3    4
                               E1      E2     E3    5
                               F1      F2      F3    6

This is how its displaying

Plz let me know where I am going wrong

Thanks

Ashok

Former Member
0 Kudos

Yep,

You are correct. I didn't even think about that.

The best way to do a "Down then Across", is to use Crystalier's idea from earlier in the post.

Jason

Former Member
0 Kudos

Ashok,

If you want to make sure both of your column sets are equal, I figured out away using sub reports.

Rather than run through the whole how to... I'm sending an example to your email.

Jason