I have a very basic question which shows my skill level in C/AL programming but please bear with me.
I have a simple tabular form1 based on table1. When I only required a single filter, I simply set the Form1 property of
SourceTableview to Where(Completed=Filter(0)).
This worked well and as records were marked completed they were removed from the form1 view.
Now, because I needed control over my filters I have been trying to set this filter (and others) in code. I thought it would be something as simple as
V_Count.SETCURRENTKEY(Completed)
V_Count.SETFILTER(Completed, '0')
Now, I also use the record variable V_Count in a SUM to count the number of non-complete records and this number changes correctly with the above code, so I believe my filter is working correctly.
But Form1 still shows all records, is my filter actually NOT working as I intended or do I need to add some update code?
Comments
If you want to set filters in a form you need to put them on the Rec variable.
Otherwise you will set them on the variable only.
Maybe you can try:
SETFILTER(Completed, '0')
This should actually work if completed is supposed to be zero.
If you wanna use SETFILTER see the Navision help: This code should work as well.
Greetz
Nicole
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
don't forget Marks posting. I regarded "V_Count" as a table and "Completed" as a field of the table.
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
When using SETRANGE remove the '' if you filter on an INTEGER
I could not get out of the mindset of attempting to use CurrForm.SETFILTER(Completed, '0')
I'm a little embarassed that I did not try this and thankyou for taking the time to help.
Good luck learning Navision 8)