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

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.

Related

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.

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.

SSRS if field value in list

I've looked through a number of tutorials and asks, and haven't found a working solution to my problem.
Suppose my dataset has two columns: sort_order and field_value. sort_order is an integer and field_value is a numerical (10,2).
I want to format some rows as #,#0 and others as #,#0.00.
Normally I would just do
iif( fields!sort_order.value = 1 or fields!sort_order.value = 23 or .....
unfortunately, the list is fairly long.
I'd like to do the equivalent of if fields!sort_order.value in (1,2,21,63,78,...) then...)
As recommended in another post, I tried the following (if sort in list, then just output a 0, else a 1. this is just to test the functionality of the IN operator):
=iif( fields!sort_order.Value IN split("1,2,3,4,5,6,8,10,11,15,16,17,18,19,20,21,26,30,31,33,34,36,37,38,41,42,44,45,46,49,50,52,53,54,57,58,59,62,63,64,67,68,70,71,75,76,77,80,81,82,92,98,99,113,115,116,120,122,123,127,130,134,136,137,143,144,146,147,148,149,154,155,156,157,162,163,164,165,170,171,172,173,183,184,185,186,192,193,194,195,201,202,203,204,210,211,212,213,263",","),0,1)
However, it doesn't look like the SSRS expression editor wants to accept the "IN" operator. Which is strange, because all the examples I've found that solve this problem use the IN operator.
Any advice?
Try using IndexOf function:
=IIF(Array.IndexOf(split("1,2,3,4,...",","),fields!sort_order.Value)>-1,0,1)
Note all values must be inside quotations.
Consider the recommendation of #Jakub, I recommend this solution if
your are feeding your report via SP and you can't touch it.
Let me know if this helps.

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")