Simple OpenRefine IF to create a new column - openrefine

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.

Related

Array contains string from column in Athena

I'm trying to check if at least one element of my_array array contains a string from my_column column in athena. I want the end result to be a boolean.
I've tried :
contains(my_array, my_column)
It seems to be partially working and I actually can't understand why because sometimes I get false even though the element of the array and the string are matching, but I never get true if there's no match.
So I've also tried (as seen here : Presto array contains an element that likes some pattern )
cardinality(filter(my_array, x->x like my_column))>0
But same issue, ending with the exact same result as above.
I thought I had an issue with some values from my_column, but after checking all my problematic values it appears the strings from my_column are clean.
For instance I am able to find a match for the first value of my_array, but no match for the second, although both values are in my_column.
Could someone please help ?
Thank you so much !!

Need to use space separated values in AG-Grid filter to return each match

I'm tasked with moving some UI-Grids to AG-Grid.
I need to allow the user to use a space delimited string for a column filter so "1 4 23 88" would return all rows where column has 1 or 4 or 23 or 88 as a value.
AG-Grid has the drop down OR option but is added clicks and only allows two values.
With UI-Grid the filter parameter in columnDefs can have a condition:
filter:{condition: filterFunction}
FilterFunction simply has the custom logic and returned true or false.
Is there something similar with AG-Grid? Reading through the docs it seems to get overly involved to create a custom filter. The UI-Grid solution is like 6 lines of code.
CentOS 7, VueJS
I ended up using:
filter:'agTextColumnFilter', filterParams: {textCustomComparator: this.filterFunction}
With filterFunction holding the logic.
https://www.ag-grid.com/javascript-grid/filter-text/#text-custom-comparator
Though I'm using a number column there is not a comparator filterParam for numbers, only 'comparator' for dates and 'textCustomComparator' for text.
This seems to work fine for what I need.

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.

Refer to NULL in List of Values (Oracle APEX)

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.

SSIS Derived Column nvarchar to bit

I have a .csv file that has a column called active which contains values of 'Yes' and 'No'.
I have used the derived component within a SSIS package, but I'm struggling to get my expression working. The field in Sql server has a data type of bit.
Active == "YES" ? "0" : "1"
Any ideas where I might be going wrong ?
You're nearly there. This will work:
(DT_BOOL)(UPPER(Active) == "YES" ? 1 : 0)
So, you just use 1 and 0 rather than "1" and "0" (as you want numbers, not strings) and then cast the whole thing to a DT_BOOL, which will map just fine to SQL Server's bit type.
I've also added the UPPER, as you seem unsure whether your value is "Yes" or "YES", and the string comparison will be case-sensitive otherwise.
(Also, note that I've assumed you want Yes to map to 1 and No to map to 0, which would be the usual way around...)
I couldnt get it to work like that either. But this works..
REPLACE(REPLACE([Column 1],"yes","1"),"no","0")