Can't get column widths right in query

LabKey Support Forum (Inactive)
Can't get column widths right in query jdutra  2011-12-09 13:38
Status: Closed
 
I have a very simple query:

SELECT
Result AS "Flu Type",
COUNT(ParticipantId) AS "Number of Positives"
FROM "rtPCR Result Dataset"
WHERE Result<>'Negative'
GROUP BY Result

with the following Metadata

<ns:tables xmlns:ns="http://labkey.org/data/xml" xmlns="http://labkey.org/data/xml/query">
      <ns:table tableName="PCR_Positives" tableDbType="NOT_IN_DB">
        <ns:columns>
          <ns:column columnName="Flu Type">
            <ns:displayWidth>400</ns:displayWidth>
          </ns:column>
           <ns:column columnName="Number of Positives">
            <ns:displayWidth>100</ns:displayWidth>
          </ns:column>
        </ns:columns>
      </ns:table>
    </ns:tables>

Basically, I would like the Flu Type to have enough room that it will fit on one line. The Number of Positives is a number less than 100, and doesn't need much room at all. However, no matter what displayWidths I put in the metadata, the Flu Type column stays tiny. I have successfully used metadata very similar to the above in other queries, and it has worked. In fact, if I add a random column to this query, and give that column a displayWidth, it works. But the displayWidth on the two existing columns does not seem to work.

A picture of the resulting query is attached. Any suggestions would be appreciated!

- Jen
 
 
Ben Bimber responded:  2011-12-09 13:58
Hi Jen,

I have spent a lot of time fighting with column widths too.

A couple questions or suggestions:

1) are you sure the XML file is being applied at all? try to change the columnLabel on one of the columns and see if it's picked up as a quick check.

2) perhaps try setting 'number of positives' small, like 40, and omitting it from the other column?

3) is it possible this query is inheriting metadata from the source table? I dont think it applies here, but note that if one of the columns is a lookup, you probably need to change the metadata on the display column (ie. the value that's actually being shown)
 
jdutra responded:  2011-12-10 09:57
Ben,

I probably should have mentioned that I did try changing the columnLabel, and that works, so I know that the XML file is being applied. I have also tried a number of different widths, and tried setting for one column but not the other, all with no affect.

However, it looks like #3 was my problem. Result comes from a list, and when I changed it to SELECT Result.Value as "Flu Type" then my column widths worked! I never would have thought of that. Thank you so much!

- Jen