psql extremely expanded display of table on command line - psql

I have a table that should be occupying much less space on psql command line, for some reason the format is being displayed very weirdly. Please have a look at this picture, it describes the problem better than any words I may write here.
As you may see some columns names are overlapping and the table is just ugly. If I expand the display you can see how the table is structured .

psql does not add extra spaces to the output.
The problem must be that you have lots of training spaces at least in some of the data. psql will align the output with the widest column in the result set.
One possibility how that can happen is if you define columns with a type like char(100), which will pad the value with spaces. It is a good idea to avoid the char data type.

Related

libxlsxwriter multiple formats on a cell

First time poster, long time reader!
I am using libxlsxwriter in C.
I want to color rows either green or red and give the columns a different format each (which is either a date, a 2 decimal number or a 7 decimal number, or default.
the problem is that only the later is applied to each sell. so if do:
worksheet_set_column(bla, bla, bla, date_format)
//later in a loop:
worksheet_set_row(bla, bla, bla, green_format).
the cells will only have the green_format but the the date_format
is there a way to apply both?
I have a very messy solution where i just make red and green variation of each format, i.e. date_green_format/date_red_format. but that is really messy and i would like to avoid it aat all cost.
Is there a better way?
Thanks!
First use worksheet_set_row() and then use worksheet_set_column().
As per the documentation,
The format parameter will be applied to any cells in the row that don't have a format. As with Excel the row format is overridden by an explicit cell format.
Refer: worksheet_set_row()
is there a way to apply both? I have a very messy solution where i just make red and green variation of each format, i.e. date_green_format/date_red_format. but that is really messy and i would like to avoid it aat all cost.
Unfortunately that is the only possible solution. In Excel a cell that is at the intersection of a row and column format has a separate cell format that is a combination of both. As such, with libxlsxwriter you will also need to create and add a cell format that is a combination of the row and column formats.

Inspecting text in Google Sheets from vlookup without destroying formula, text wrapping, or changing column width to "fit to data"?

This has been an issue I've lived with for a really long time, without ever really figuring out a reasonable solution. I feel like there must be one, however.
I do a lot of spreadsheet preparation for non-technical users. In my current situation, it involves a selection committee that needs to view candidates' submissions. The problem is, each candidate's responses vary quite a bit in length and size. I am using very basic VLOOKUP's to populate a series of columns so that when a given applicant is chosen from a dropdown menu.
Here is the dilemma, to me it feels like there must be a way to view the entire content of a vlookup result WITHOUT having to change row/column width/height to "fit to data" or some arbitrary huge number. For normal text boxes that get cut off, you can just double click the cell, and it neatly displays the entire text content for you. When I try to do this with a vlookup formula, double-clicking just displays the vlookup formula itself. The only way around this I've found is copying the cell, then doing paste-special and choosing "value only". But doing this destroys the vlookup formula, requiring a quick control-Z to undo afterwards -- something fine for me, but not something I can't reliably ask my end users to know to do.
Put succinctly, is there no other way to display/access the entire text content of a cell that is cutoff, if the content is the result of a v or hlookup formula? A way, that is, without value pasting over the formula, or having to adjust the column width and/or choose 'wrap text' and changing the row height?
I was hoping there might be some way to get the contents of the vlookup to appear in something like a tooltip popup if you hover over the cell? Or some other solution.
move your vlookup formula up a row like if its now in B2 and the output of vlookup is 1 column put this in B1:
={""; ARRAYFORMULA(IFNA(VLOOKUP(...)))}

How to delete empty cells and shift up in Google Sheets?

Is there a way to delete empty cells in a given range and shift the column up to the desired display as shown below? Closest I came was
=ARRAYFORMULA({A1:C1; TRANSPOSE(SPLIT(TRANSPOSE(QUERY(A2:C,,999^99)), " "))})
which removes empty cells, but splits the first names and surnames into separate cells, which I have not figured out how to avoid. Pfa a made-up sample of current and desired displays:
Current Display
Desired Display
I'm new at this, but I came up with a bit of a brute force method, which may help you.
={
{(A1:C1)};
{FILTER(A2:A100,A2:A100<>"");indirect("N1:N" & 100-counta(A2:A100))},
{FILTER(B2:B100,B2:B100<>"");indirect("N1:N" & 100-counta(B2:B100))},
{FILTER(C2:C100,C2:C100<>"");indirect("N1:N" & 100-counta(C2:C100))}}
Assuming your data block is in columns A1:C100, this formula filters blank cells from each individual column, and then pads each column with blank cells at the bottom, to make the three arrays equal in length/dimension.
Note that in "100-counta(...", the 100 is the expected maximum length of your data column.
This could be calculated, and must be the same for all three columns.
Note also that the first array is horizontal (ends with a semi-colon), followed by the three columns, stacked beside each other (ends with a comma).
Here is a working example.
https://docs.google.com/spreadsheets/d/1MGaqqGrkmIliuAzEqxPtdEVZXWPN2K5W7jFFM-ZnwgE/edit?usp=sharing
If I missed something you were trying to achieve, let me know.
Also, I'm sure that there is a more elegant way to do this, or one not requiring the use of a block of "reserved" blank cells, but I couldn't think of that at the moment.
Edit: The formula as follows also works. But you need to remember to set the "100" value to be equal to the number of rows in your data block, since we pad the columns with the necessary number of blanks rows, after removing the blank cells in each column.
={
{(A1:C1)};
{FILTER(A2:A,A2:A<>"");indirect("N1:N" & 100-counta(A2:A))},
{FILTER(B2:B,B2:B<>"");indirect("N1:N" & 100-counta(B2:B))},
{FILTER(C2:C,C2:C<>"");indirect("N1:N" & 100-counta(C2:C))}}

FastReport CrossView does not calculate column width correctly if column header is printer vertically

I have a FastReport CrossTab report with long column names, which would expand into multiple pages if I were to print it. I thought maybe I can rotate the column headers in order to save some space. But FastReport does not compute column widths correctly, and the generated report looks like this:
Any thoughts?
I have gotten good help from the Fast-Report website by opening a ticket. This seems like the kind of question you might need to ask there.

Removing white space in a table

I am having an issue with too much white space. Here's a picture of my data fields with placeholders representing the largest digit count possible in them.
As you can see, after the last "P" the values escape the scope of the chart. While I could increase the size of the table as a whole (currently textwidth), that would be a poor design choice on my part. What I'm thinking is to utilize all of that wasted white space. I don't know what to do though.
When I have all single digit values, the table looks perfect. I want the increased number size to "consume" the white space before forcing the table out of it's defined bounds.
I was hoping using extracolsep with no arguments would remove whitespace, but it sadly does not.
try adding this command before your table;
\renewcommand{\tabcolsep}{1pt}
the default column separator width is 6pt inserted before and after column contents, but this will change that. Replace 1pt with whatever you need.

Resources