I'm making some dashboards in superset apache, but I have the problem that it makes me null when it doesn't find values to add and this is annoying for the view, for the client. I can't find an option that suppresses the null values or in any case that puts zero.
thanks
David example is great! but if you don't want to miss those counts, you could do a calculated column where null values go to a 0 label
case when my_col is Null then 0 else my_col end
You should be able to do that by adding a custom WHERE clause in order to remove null and 0 values from the display.
Related
To simplify my question, consider the following table in dolphindb:
t=table(1..5 as id, 1 NULL 3 NULL NULL as x)
I would like to forward fill nulls ONLY for the rows that I specify. For example, only for the row with id=2. I tried the following SQL query but the result was unexpected.
update t set x=ffill(x) where id=2
The table t was not updated at all. I would appreciate it if someone can point out the mistake in my code. Thanks!
The 'where' condition in SQL is always executed before the 'select' calculations. Therefore in this case you lose the information about id=1. Try this:
update t set x=iif(id==2, ffill(x), x)
This uses dolphindb function iif. Effectively it is a loop.
I have a case in BizTalk where I want to map an "Attribute Node" which type is Date that can't be null or empty and to avoid problems I need to suppress in the destination transformation map when the source is null.
I followed this link to try the same thing that we do with Nodes but doesn't answer my problem.
https://social.technet.microsoft.com/Forums/security/en-US/4ab184e0-c978-429c-a80d-e869732de8a2/how-to-suppress-empty-nodes-in-biztalk-map?forum=biztalkgeneral
Anyone have an idea?
Thank you,
Roberto
Edited
The link didn't mentioned that the Logical String returns True or Nill depending on your source.
I've obliged to check if is empty and as well null
From the source, connect to a Length Functoid, then Greater Than 1 Functoid.
Connect the Greater Than Functoid to the target.
However you end up composing it, connecting a Functoid that returns a boolean is treated as a create yes/no regardless of any value also mapped.
I have a Table with column of type:
ARRAY<STRING(36)>
All data have a value, but i can not set NOT NULL.
ALTER TABLE Organizations ALTER COLUMN superfinUsersList ARRAY<STRING(36)> NOT NULL
error: Cannot add NOT NULL to column Organizations.superfinUsersList
Unfortunately this functionality for Arrays is not currently supported, so the error message is correct, and documentation will be updated to reflect this.
This is now possible, you just need to make sure all your rows have some value for that column. Unfortunately the array itself can still contain null elements.
My understanding is that nulls last is not possible with QoQ. How do I trick coldfusion into sorting null values last whether i'm sorting the row ascending or descending?
I've tried using case in the SELECT and ORDER part of query, but looks like CF is not liking it (running on railo)
There may be better options, but one simple trick is to add a column representing sort priority. Assign records with non-null values a higher priority than null values. Then simply sort by the priority value first, then any other columns you want. Since the null values have a lower priority number, they will always sort last.
<!--- 1 - non-null values 2 - null values --->
SELECT 1 AS SortOrder, SomeColumn
FROM theQuery
WHERE SomeColumn IS NOT NULL
UNION ALL
SELECT 2 AS SortOrder, SomeColumn
FROM theQuery
WHERE SomeColumn IS NULL
ORDER BY SortOrder, SomeColumn ASC
(It is worth noting you could probably do something similar in your database query using order by instead of union.)
QoQ on both ColdFusion and Railo have a very limited SQL vocab, and there's nothing that deals with how to collate nulls. So as #Leigh has suggested, add another column - without any nulls - which represent the sorting you want.
Or, better, if possible deal with all this in the DB. Obviously this is not always possible (as the record set you're querying might not have come from a DB in the first place ;-)
...there was one more way, but it relies on values being NULL and not empty ''.
I'm going from memory here, but this is essentially it, using || only works if the value is non-null, so using the null values descending sort first, I get the values at the end.
<cfquery>
SELECT *, '1' || #sortCol# as isNull
FROM table
ORDER BY isNull desc, #sortCol#
</cfquery>
Note I'm not actually advocating the use of this and I'm not sure if CF would handle it the same way
Is there a way of disabling the item in the database instead of deleting it.
Any one with any idea , Do reply
i guess it depends on what you mean by 'disabling'. you could add a BooleanField called e.g. disabled, and then filter your queries (probably best done via a custom manager) so instead of
Mymodel.objects.all()
do
Mymodel.objects.filter(disabled=False).all()
Not in SQL. What you probably would be ending up doing to solve the problem is either
Moving the "disabled" values to another table, either by a trigger or stored procedure
or
Adding an 'active' flag to the table with default value 1 and setting it to 0 instead of deleting. That would require an extra condition on every query (and active=1) that does not want to query disabled records.
You can set a field in the table which you set if the row is valid or unset if the row is deactivated.