Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Show results in columns vs rows

Posted on 2016-09-01
5
Medium Priority
?
92 Views
Last Modified: 2016-09-01
I need to have my results displayed in as many columns as the results need (the number of columns will vary depending on the record) instead of the rows the results are currently being written to.

Here's a sample resultset as it is dumped into rows:
ID          lname          fname          response          current
100       Doe               John             Mickey              Donald
100       Doe               John             Mickey              Tweety
100       Doe               John             Mickey              Daffy
100       Doe               John             Minnie              Pluto
100       Doe               John             Daffy                 Pluto

Here's what I need it to be:
ID       lname    fname    response1    response 2    current1   current2    current3
100    Doe         John      Mickey                                   Donald      Tweety      Daffy
100    Doe         John      Minnie           Daffy              Pluto

Or it can be like this:  (This way would be awesome!)
ID      lname      fname    response1   current1   response2    current2
100   Doe          John        Mickey         Donald     Minnie           Pluto
                                                                Tweety                             Daffy
                                                                Daffy                        

To complicate matters, the database this is being written against is Intersystems' Caché, which is FAR from SQL Server unfortunately, so I can't do temp tables, stored procs or other normal database stuff.
0
Comment
Question by:fcsIT
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 41780445
Please see the basics from link below hopefully it will help to achieve the "pivot" function that you need as it looks like it supports SQL code :

http://www.artfulsoftware.com/infotree/qrytip.php?id=78

Worst case if none of us here can help I see "David E. Nelson" has some training session on "Creating DeepSee Models, Pivot Tables, Dashboards, and KPIs"
1
 

Author Comment

by:fcsIT
ID: 41780465
Thank you Icohan, but unfortunately Intersystems' Caché doesn't support pivot.
0
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 41780516
Well I'm not expert for sure in Intersystems' Caché database coding/admin however according to this link http://www.intersystems.com/uk/library/library-item/introduction-to-deepsee-and-iknow-for-intersystems-campus/ there there is some training session on Pivot table right?

And what about this? it looks to me you can use DeepSee to do just that - Pivot right? is a BI tol provided by

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2GS_ch_intro
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2DT_ch_pivotetc

Besides that, In MySQL the "pivot" it's a two-step:

1. In an inner query, write one aggregating expression per reporting column,
2. In an outer query, build the horizontal sums:

and as Intersystems' Caché  supports SQL...that should do it right?
0
 

Author Comment

by:fcsIT
ID: 41780624
Well, what complicates this more is we inherited Caché when it came with a vended product.  That vendor doesn't allow us to do pretty much anything with Caché.  The vendor has blocked the areas in the System Management Portal that enable DeepSee.

Looks like I'm probably up the creek on this.  Sounds like I need to start building macros into a spreadsheet that can manipulate the data in its current form to make it what I need.

Gotta love these situations...

Thank you Icohan.  I appreciate your diligent help.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 41780640
"Sounds like I need to start building macros into a spreadsheet that can manipulate the data in its current form to make it what I need."
Can't you bring it in mySQL instead or any other database - even SQL Express if is not > 2GB and do it there instead? Maybe that's easier than Excel.

Also, "hat vendor doesn't allow us to do pretty much anything with Caché. The vendor has blocked the areas in the System Management Portal that enable DeepSee." - I would check if is not to dificult to see if this was done on purpose due to some licensing because if it does not require additional money then..you get the idea - is your right to use the product you paid for to FULL extent instead of bending backwards to reinvent something thats built in.
If is money related see maybe you can build a case to get it "unlocked" and utilized elsewhere as BI...must be useful to someone over there if they have the money to buy such product.


Good luck!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question