Is this the right way to exclude rows with NULL values from the LABKEY.ext.Store ?

LabKey Support Forum (Inactive)
Is this the right way to exclude rows with NULL values from the LABKEY.ext.Store ? Leo Dashevskiy  2012-05-15 11:59
Status: Closed
 
Thanks guys for the answers.

Here is the original SQL:

SELECT DISTINCT FCSFiles.Keyword."Sample" AS Sample
FROM FCSFiles
ORDER BY Sample

resulting in:

Sample
Comp
PBS
_

(the last row is blank, I used _ to highlight that)

Though, this query:

SELECT count(DISTINCT FCSFiles.Keyword."Sample") AS Sample
FROM FCSFiles
ORDER BY Sample

results in:

Sample
2

I guess count() does not include null/empty rows (I'm still not 100% clear if it's empty or null despite what you say...)


Whereas:

SELECT DISTINCT FCSFiles.Keyword."Sample" AS Sample
FROM FCSFiles
WHERE Sample != ''
ORDER BY Sample

give the following error:

ERROR: invalid input syntax for integer: "" Position: 1093


Though, if on top of the first query in the table view I was to apply a LABKEY filter type: "Is Not Blank", then I get exactly what I need (the same result as the first query, but without the last row!) and the info message about the filter is: "Filter: (Sample IS NOT NULL)", but that does not seem to mean in SQL "Sample IS NOT NULL", because that still results in an empty query.

I was about to think that I got my answer: I exported the query and the filter into JavaScript and got the following filter applied to the selectRows() Labkey call: LABKEY.Filter.create('Sample', '', LABKEY.Filter.Types.NOT_MISSING)
which is not what I used first (was missing the 2nd argument ''), but if I was to apply the same filter to my store, it still does not work.

Feel free, if you wish, to log into the test server (use your hutch credentials), go to "Test Flow" project and browse the files and play with the query browser:
http://dhcp157184.fhcrc.org:8080/labkey

Thanks.
-Leo