Hi Guys
I couldn't find a way to pass a SET of values to a filter. Setrange as the name says only takes a range. See below example:
Hi Guys
I couldn't find a way to pass a SET of values to a filter. Setrange as the name says only takes a range. See below example:
Just wanted to let you know I had exactly the same challenge to solve and this answer solved it.
I knew this was a possible solution but I actually thought there would have been a more build-in solution.
Anyway, thanks!
NAV / BC was originally written before they were using SQL Databases and this is part of the legacy of that. You're not actually directly accessing SQL Data - it's abstracted into the RECORD type which is not what you or I would be familiar with as a RECORDSET or DATASET type object.
Occasionally frustrating but given you can write 20 lines of code and have a functioning page and table that persist your data and you never add your own Commit or Rollbacks I'm ok with it.
Thanks everyone..got it working with 123|345|453 pattern..
GETFILTER does not work as this gives you the filter itself rather than the resulting record set. In SQL its easy to apply this kind of set operation but I'm surprised we do not have a predefined method to handle this..something like
Item.Setrange(Type, Inventory);
ItemFilter := GETRECORDSET
Hii,
You can concatenate the items nos with separate '|' in the text variable and pass that variable as a filter in pricelist.
e.g.
If Item.findset then
Repeat
Textvar += Item."No."+'|';
Until item.next =0;
Thanks
Verify, If this answer helpful to you.
If I understand what you want to do, you want to filter on a group of items.
to do that for Item No.s 1234 and 2345 then would do a "No.", '=1234|2345' and that should work
If you do it in the client it works. Not 100% sure of the syntax but I think the Set Filter with this structure will work
You would just build a | separated list somewhere in a variable and pass it to the SetFilter.
ItemRec.No will only hold one item no and not a filter expression.
So what you can do is:
myfilter string := Itemrec.GETFILTER("No.") ;
This will give you the filter that is currently set on your item record.
Then use that in the line you marked yellow.
PriceLine.Setfilter("Asset No.",myfilter);
Then the filter on the "No." filed on the item table will match the filter on the "Asset No." in your price line table.
Hope this helps you.
André Arnaud de Cal...
292,884
Super User 2025 Season 1
Martin Dráb
231,758
Most Valuable Professional
nmaenpaa
101,156
Moderator