Refer to NULL in List of Values (Oracle APEX) - sql

So I have a List of Values, and I want to have a display value of "Yes" when the return value is NULL. I tried leaving the return value blank, and even writing null, but when I go to my table and use the LOV, instead of getting my return value "Yes", I still get
-
Is there a proper way to refer to NULL in a list of values return value? Thanks.

I know that 3.x and earlier behave differently. I'm on 4.1, but I think 4.2 is the same.
In the "List of values" section of your page item definition, ensure that:
Display Null Value is set to: Yes
Null Display Value is set to: Yes
Null Return Value is left blank

Where are you seeing the dash? In a report showing the information? If so, reports default nulls to dashes - see 'report attributes' -> 'show null values as'.
Otherwise, you may need to post what you're using for your LOV. And/or maybe an image of what you're seeing.

Related

MS Access: eval() returns NULL when accessing .Column(x, y) property

I have a form and to validate it, I am using eval(). Background is, that I have defined rules in an table. These rules contain placeholders. The rule is compiled and then eval() should check wether its true or false.
Part of one rule contains a check on a listbox value. I identified this to be the problem. I could reduce it to the following:
Application.Forms("frmDMAE").lstHistory.Column(6, Application.Forms("frmDMAE").lstHistory.ListCount - 1)
returns ie 2,
eval("Application.Forms(""frmDMAE"").lstHistory.Column(6, Application.Forms(""frmDMAE"").lstHistory.ListCount - 1)")
returns NULL - but I can not figure out why!?
eval("Application.Forms(""frmDMAE"").lstHistory.Column(6, 5)")
returns NULL as well!? Column 6, row 5 definately contains a numeric value.
Also pasting the following into the debug window shows "2" as return value in both cases:
Application.Forms("frmDMAE").lstHistory(6, Application.Forms("frmDMAE").lstHistory.ListCount - 1)
Application.Forms("frmDMAE").lstHistory.Column(6, 5)
Any idea anyone??? I don't have a dime anymore.
[EDIT]
Solution of Andre works. Just change the indexes of the .Column property within Eval(). Use .Column(rowindex, colindex) instead of .Column(colindex, rowindex)!
[/EDIT]
Thank You very much,
Thomas
Wow. What a strange thing.
Apparently you have to switch the parameters (or array indexes) of the .Column property around when using it with Eval().
My listbox has 2 rows and 7 columns, with a number in the 6th column (= column 5).
? Forms!myForm!myList.Column(5,1)
3600
? Eval("Forms!myForm!myList.Column(5,1)")
Null
? Eval("Forms!myForm!myList.Column(1,5)")
3600
I don't really know what to make of this.
Note: I'm using Access 2010.

Simple OpenRefine IF to create a new column

Im trying to create a new column which contains true or false. Basically column A has a number in it, between 1 and 6, if its higher than 3 I want the new column 'match' to contain true, otherwise it contains false. Using the add column based on column in trying the following GREL
if(value > 5, "True", "False")
That basically results in EVERYTHING being false.
I know my IF statement is correct because the following works
if(value.length() > 1, "Double", "Single")
Im just confused why if Value is greater than 5 doesnt work, its obviously missing something but I cant seem to pinpoint it in the docs.
Your GREL if() is correct. Our docs for that are here:
https://github.com/OpenRefine/OpenRefine/wiki/GREL-Controls
But I wonder if you really have all number values in that Column ?
Are all the values "green" color ?
If not, try using Edit Column to Trim Whitespace and then convert the Text to Numbers.
Then try your if() on that column again and see what happens.

CASE WHEN THEN (Return Column) ELSE END

I'm very new to SQL and mainly use Excel, I am using Oracle BI and need to add a column that does the following.
=IF(A1="EG123456",B1,"")
I've got this far.
CASE WHEN "table1"."clientnumber" = 'EG123456'
THEN "table1"."BookingID"
ELSE ''
END
it accepts the formula but when I go to view the results it says "View Display Error"
It seems likely that BookingID might be a type other than CHAR/VARCHAR; for example perhaps it's a numeric field? All possible returns form a CASE must be of compatible type.
Would it work to use ELSE NULL instead of ELSE ''? NULL will be compatible with all types and will come across as "blank"; but depending on how you further process the results, you may need to beware of the "strange" rules for handling NULL values.
The other option might be to cast BookingID to a CHAR type. e.g if you know that it's never more than 20 characters, you could say THEN CAST(BookingID AS CHAR(20))

Orbeon repeats do not support initial values after first iteration

Using Orbeon to create a form, in a repeat I ran into an issue with setting Initial values. After the first iteration, the default value does not work. After some research, I found this to be a common issue, but no resolution. Need an expression that would keep track of each node that is set and account for any values that are changed from their initial value.
Thanks!
You could try using a Calculated Value (rather than an Initial Value) which sets the default value if the element is blank, but leaves it alone if it has been completed.
Ie, try something like:
if (. = '') then 'default value' else .

Why does bcp output null when the column contains an empty string and empty string when the column is null?

This struck me as really weird behaviour and I spent a while checking for bugs in my code before I found this
"out copies from the database table or view to a file. If you specify an existing file, the file is overwritten. When extracting data, note that the bcp utility represents an empty string as a null and a null string as an empty string." (from http://msdn.microsoft.com/en-us/library/ms162802.aspx)
Obviously this allowed me to fix my problem but can anybody think of or does anybody know a reason why this is the case?
It's been some time, but I'm sure it's a backwards compatibility/legacy back to SQL Server 6.5
SQL Server 6.5 could not store empty string: there was always one space. This changed with SQL 7
So '' -> NULL and ' ' -> '' is correct from an ancient history perspective.
SELECT ARTICULO as Articulo,
case when rtrim(CCOLOR) = '' then null else rtrim(CCOLOR) end as Color,
case when rtrim(TALLE) = '' then null else rtrim(TALLE) end as Talle,
from precios
Send null in place of empty.
I find the best solution here:
https://bytes.com/topic/sql-server/answers/143738-bcp-inserting-blank-space-empty-string
I found a work around, using a Case structure in the sql query to
change empty string to a null. The BCP in turn outputs the resulting
null as an empty!
Thanks for your assistance.
Eric
This is related to the "default values" section for BCP:
https://learn.microsoft.com/en-us/sql/relational-databases/import-export/keep-nulls-or-use-default-values-during-bulk-import-sql-server
For example, if there is a null field in a data file, the default value for the column is loaded instead.
You have to think back to days where importing plain text files from other weird systems. BCP translates '' as "not defined"(=missing data) and sets a NULL in the database (=missing data). The other way around a NULL from database must be a '' for the other systems.
To get the 'real' data out of the database use the -k switch:
https://learn.microsoft.com/en-us/sql/relational-databases/import-export/keep-nulls-or-use-default-values-during-bulk-import-sql-server#keep_nulls
The following qualifiers specify that an empty field in the data file retains its null value during the bulk-import operation, rather than inheriting a default value (if any) for the table columns.
Then you have your ASCII 0x0 in your file/database.