How to force a vertical table or limit columns in Hirb? - ruby

I want to display few active records in rails console, I have Hirb enabled. The table is narrow enough to be displayed (so Hirb uses standard, horizontal table) but columns are so narrow that content is completely unreadable. Do you have any idea what I could do about it?
Displaying only few columns would be great (I have records in a pure Array, not AR collection, so I cannot just pass :select to finder method). Forcing Hirb to display records in vertical table would be perfect as well.
Thanks in advance.

If you look at the 'Views: Anytime, Anywhere' section of hirb's readme, you'll see that hirb provides you with a table command that let's you select columns/fields:
>> extend Hirb::Console
=> main
>> table My_AR_Array, :fields=>[:field1, :another_field, :and_another_one]
# ... Displays table with only these three columns
If you'd like to enable a vertical view, read the docs. In particular, learn about a table's options (:vertical is what you want) and learn about hirb's config file format.
In the future, please ask these questions on github.

Related

POWER BI How to create a data table for a histogram

I have been unable to locate any instructions on how to create the standard data table for a histogram or instructions on how to pivot a data table visual by using a date field(column) as the headers.
Below is a simple example of what I need. Excel calls this a data table. If it is called something else in PowerBI I can't figure it out.
Ultimately, I just need to transpose the relevant data from row format to Column format, but I prefer not to do this for the whole table in the background. I'd prefer to do it just for this visual and leave the background data in its current format for other visuals.
The feature you are looking for is called "Show as a table", you can get it from the "..." menu in the top-right corner of any visual.
It's documented here, although a little out-of-date currently:
https://learn.microsoft.com/en-us/power-bi/consumer/end-user-show-data
FWIW that looks like a clustered column chart, not a histogram. With a histogram, the X axis is typically made up of buckets of a numeric value, whereas your example shows dates.

how to set dynamic header using BIRT?

I am newbie to BIRT and unfortunately my first task is over complicated.
I want to create table like this
Birt Report Snap
the columns in this picture must be dynamic. the data for the column name is in database and I have to fetch it and create columns on the go. 2nd to put values against it.
kindly tell me if this thing is doable in birt. I am new to this so please don't give negative ratings
thanks.
I believe what you are looking for is called a Cross Tab Table.
Here is a tutorial video on it: BIRT - Cross Tab Table
In addition to SBurris answer, which is the way you should try first, I can assure you from my experience that what you want is in fact doable with BIRT, and even in two different ways.
However, some of the minor aspects might be a bit quite tricky for beginners, e.g. the merged cells in the column header, the different background colours and border widths for the columns. So, these style aspects shouldn't matter at first, you can tackle them later.
The first, by far easiest and standard way to achieve this kind of report layout is a cross tab, as SBurris said.
The second option is - depending on the database backend - to use a "normal" Table report item in they layout and to "create the cross tab" with SQL.
This is more powerful IMHO as the BIRT Cross Tab report item, but also more complicated.
For examples, see here:
Pivot / Crosstab Query in Oracle 10g (Dynamic column number)
Pivoting rows into columns dynamically in Oracle
How to do Pivoting in Oracle 10g
(you get the idea)
To use this with BIRT, you'll have to select the column title values in addition to the cell values.
You have to decide how many columns do/should fit on your page (if you're using PDF output).
You can use the maximum aggregate function in the visibility expression of the columns to hide empty columns.
If the number of logical columns exceeds the number of columns for a single page, you can extend the idea further by dividing the cross tab into several, each with at most N columns.
However, note that this approach will need an experienced BIRT developer...

Set sort on first column as default in TOAD

I'm using Toad for Oracle 12.5 and a little thing anoy me : when I look into the "Data" tab of a table, the row order is all jumbled up.
On any other DB software I used (SQL developper, phpmyadmin, etc), the default data view would retur the rows ordered by the primary key
So, I would like it to automaticly by default sort the data in the "Data" tab of each table to the first column, or even better, to the table primary key.
I've looked in the options but I can't see anything related to this.
Have some of you had the same problem ?
No oracle client that I have seen ever tacks an "order by" onto a statement on its own accord. It returns what the query returns in the order (or lack thereov) that it receives it.
Now it may LOOK ordered if the rows were inserted in order, but that is a fluke. Period.
And frankly, I'd be upset if a UI arbitrarily added expensive sorts to my queries unless I specifically told it to.
I have some BIG tables. presuming that I want the UI to take the time to scan the index and grab the lowest PK values just because I opened the DATA tab? No. Dear me - NO!
If I want it ordered, I will open the sort/filter dialog and specify so, or click on the appropriate column header to sort the results.
ADDITION:
If there ARE some tables where you want this behaviour (I can see the convenience if checking code tables for example), then use the sort/filter dialog on the data grid for that table to set an order by and TOAD will remember that setting for that table in this schema until you remove it. So you CAN set this behaviour where you want and not deal with the performance aspects where you don't.

Is it possible to reverse a column transformation in Spotfire, and if not, what are the alternatives?

I've made the mistake of using the 'Calculate and Replace Column' feature to replace the wrong column, and realized after the fact. The column I replaced corresponds to last names and is important. I would like to retrieve this column but maintain my other 15 or so data transformations. Ideally, I would like to remove this transformation, but I've come up empty so far. Here's what I've tried:
I tried adding the 'last name' column again from the same external source, using >Insert >Columns... I also tried renaming this column to avoid the data transformation. Unfortunately, this resulted in an entirely empty column, so it did not successfully match to the table or was affected by the transformation..
I checked the source information, and found exactly the 3-4 lines that I wish were not there. I thought it might be possible to edit this but haven't found a way. This seems like it would be the easiest.
Another idea I had was I could replace the data table with the same source, and repeat all of the transformations from the replace data table dialogue (excluding the bad one). This is my next plan of attack, but I figured I would come on here to see if there's an easier way first.
Thanks in advance!
Good News for YOU!!! #jeremyVollen.
It is possible to 'edit' your transformation per Tibco article 44098.
Resolution: If there are more then one transformations on a data table and you need to edit any of those transformation, follow the steps below:
Go To Edit >> Data Table Properties.
Select the desired data table inside which the transformation has been added and click on Refresh Data > With Prompt.
A new window will pop up which will allow you to make the desired changes in each of the transformations.
unfortunately it is NOT possible to reverse data table transformations.
it IS possible to undo the transformations with Edit>>Undo or CTRL+Z, but that's as far as it goes.
my strategy for dealing with this is (in accordance with your #3) to visit Edit>>Data Table Properties, select the table I'm interested in, select Source Information, then copy the contents of the textarea and paste it into notepad. then, I'll File>>Replace Data Table and start over from the beginning while keeping the notepad open so I don't miss any steps.
I realize it's not ideal, but there is unfortunately not another way.

How to Sort Data Table like FogBugz Cases Table

Anyone ever see how fogbugz sorts their tables? When you click to sort the column, they actually break the table up into many small tables that have each category of info.
Wondering if anyone knows how they do this?
Looking to implement this feature.
If you take a look through the cases page, and sort you can see what I mean.
Any help would be AWESOME!
Still Haven't figured this one out.
EDIT: #Peter, I don't want to postback and recreate a table every time the header title is clicked for a sort. I also want to know if their is a generic solution for this. If I click on the header to sort, by the way of javascript, it seperates the "one" table into many and I want to know if their is any generic solution for this because its just a MUCH better way of viewing a sorted Table.
EDIT: I do need a javascript sorter, but if you look right down at the implementation of fogbugz, it produces a different result...
Yup, Rich got it (I coded this feature into FogBugz a long while back).
If you have to do this on the client you have no choice but to sort the data, iterate through it generating table row after table row, and every time you hit a new sort value you create a new thead w/ the appropriate information.
To be honest it would be a pretty cool modification to this jQuery plugin: http://tablesorter.com/docs/ and you'd be able to leverage a lot of their work. If you're going to put in the time and create a general solution, might as well make it accessible to the community.
Without knowing specifically how Fog Creek accomplishes this, the way that I would do it is to output a table header, then iterate through the list, outputting a footer and a new header each time the group value changed.
Not sure what answer do you expect. SQL query for this would simply use ordering on selected column, and UI would start new table each time this value changes.
Here is screenshot of FogBugz with this sorting, after clicking on Priority column.
http://img297.imageshack.us/img297/6974/76755363ee3.png
Of course, starting new table doesn't make sense for every column (title, case #).
Edit: If I understand correctly, you're looking for a way how to do this in a browser without loading new page. If this is the case, I would suggest at least some server-side support, which would return your data in correct order, and properly structured for subtables (in xml/json/whatever you use). Your javascript will use this data to recreate tables. I am sure others with more web-ui experience will provide you with better answers.
I've used the Sortable Tables script from Kryogenix with some good results.
I don't know if it is relevant, but we store the results of a query in a temporary table in SQL, and then reference current-row-less-one to see if a Category has changed, and indicate this in the resulset.
In some instances we "indicate" this with a column containing
<tr><td colspan=999>Category Heading</td></tr>
so that the web page can just "inject" that into the table it is building.
SELECT Col1, Col2, ...,
[CATEGORY] = CASE WHEN T1.CategoryCol <> COALESCE(T2.CategoryCol, '')
THEN '<tr><td colspan=999>' + T1.CategoryCol + '</td></tr>'
ELSE ''
END
FROM #MyTempTable AS T1
LEFT OUTER JOIN #MyTempTable AS T2
ON T2.ID = T1.ID - 1

Resources