Horizontal database results

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have data from the database results that looks like:

District No
1 100
2 400
3 50
4 1000

would like it to look like

District 1 2 3 4
No 100 400 50 1000



Thank you
 
To do this in the DRW, you would have to create a custom query that contained
fields like this:

Sum(Iif([District]=1,1,0)) AS Dist1,
Sum(Iif([District]=2,1,0)) AS Dist2,
Sum(Iif([District]=3,1,0)) AS Dist3,
Sum(Iif([District]=4,1,0)) AS Dist4

and then GROUP BY and report on those four fields.

Of course, this would be a mess if you had a variable number of districts.

Otherwise, you would have to code this in ASP.NET or ASP. In fact, that
might be easier anyway.

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*-----------------------------­-----------------------
|\----------------------------­-----------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||----------------------------­-----------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/----------------------------­-----------------------
*-----------------------------­-----------------------
 
in the DRW you can choose which layout you like (it's the last or last but
one screen in the results wizard).
 
Jim,

I have the same issue - do you have a pointer to some sample code we can use
to change DRW output from rows to columns. By the way I often reference your
FrontPage book!

Thanks

Jim Buyens said:
To do this in the DRW, you would have to create a custom query that contained
fields like this:

Sum(Iif([District]=1,1,0)) AS Dist1,
Sum(Iif([District]=2,1,0)) AS Dist2,
Sum(Iif([District]=3,1,0)) AS Dist3,
Sum(Iif([District]=4,1,0)) AS Dist4

and then GROUP BY and report on those four fields.

Of course, this would be a mess if you had a variable number of districts.

Otherwise, you would have to code this in ASP.NET or ASP. In fact, that
might be easier anyway.

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*-----------------------------­-----------------------
|\----------------------------­-----------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||----------------------------­-----------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/----------------------------­-----------------------
*-----------------------------­-----------------------

Iman said:
I have data from the database results that looks like:

District No
1 100
2 400
3 50
4 1000

would like it to look like

District 1 2 3 4
No 100 400 50 1000



Thank you
 
Back
Top