Filterstring can only be 250 characters. So if you have 15 customers with numbers that are 20 characters, you are going to run into an error. I'd consider an alternative solution, perhaps one with a temporary record variable.
How to implement and alternative solution using a record variable..
As my key is exceeding maximum character length..
Please someone help on this context.. Its urgent. ](*,)
0
Answers
1. Create a record variable for the table you wish to filter, set the variables "Temporary" probperty to "Yes".
Fill the temporary record table with records that pass youre looong filter. You can do this in different ways.
You can apply parts of your filter that are separated by "|" (or-operator) to the original table and add the records that pass these partial filters to youre temp-table.
You can also add all records and then remove records that don't pass parts of youre filter that are separated by the "&" (and-operator).
If you have a really complex filtercriteria you could loop through all records and test each one using code. If the record passes all the tests in youre code you add it to the temp table. This is usefull if you want to make a filter that compares fieldvalues to each other. For example you want a filter that givs you all customers where the "Telex No." is longer then the "Phone No.". That type of filter is not possible to create in any other way.
2. In older versions of navision there is a feature called MARK. Instead of putting the records you want into a temp table you can mark them using MARK(TRUE). Then you set the special filter MARKEDONLY(TRUE). To select wich records to mark/unmark you could use the same methodes that I have outlined above.
I think you missed the point that the filter string is too long making it impossible to filter and add records to the temp table. If you end up using a string as a filter you have certainly programmed yourself into a dead end street. A quick & dirty way out of this is to add a field to (in this case) the customer table which holds the data for filtering (boolean, option).
I think that's an awful solution. Adding a modification to the database for something the system can handle out of the box doesn't make sense. mabl4367 provided excellent examples of how this can be done.
We don't know where the filtering takes place nor if it's on the fly or permanent.
Sure it can be done mabl4367's way, but it demands a lot of code and repeated looping through (what can be) a lot of records. If the filtering will be used repeatedly and references the same records (the original post mentions 15 customers) then it would be wise to group such customers using existing options (posting groups, price groups,...) for filtering or by introducing a new grouping/filtering option (field).
P.S.:
I would really like to know what you ment by "handling out of the box".
I meant just as mabl4367 said. You can use a temporary table or mark the records. Two ways that both work without changing a table structure.
This is true, but is nothing that couldn't be solved by setting appropriate filters with the right key. That would speed up the search if it is slow. When you add a field as you are suggesting you also have to add the code to make sure it gets set correctly. That code then needs to be documented and upgraded (probably). I guess to me it just seems like a ton of extra work when NAV already provides ways to do it quickly and easily. It's not that it won't work, it certainly will. I just think it would be my last option. If the field would actually be used for more than just filtering, though, then that's a different story
Is the way which i have used is the correct way?. As its throwing me an error. "Item No already exists"
Previous post really helped me a lot. Thanks
The problem is you haven't obtained(get or find) the filtered Items record
so your process is copying the first record in the items table then copying that same record again and trying to insert it.
and giving you the error.
The potential problem is that the vendor item table has a two part primary key (item and vendor ) so you could end up inserting an item from one vendor then trying to insert the same item from a different vendor and getting an error.
Steve
So how to get or find Filtered Record??
Suppose i want to filter items table with ItemVendor table records.
Thanks..
The above code creates a temporary table with few records. But its only has records. But i want filtered records.
In this code, with each iteration of the REPEAT loop, the resultset in ItemsTemp represents the set selected by a hypetetical filter containing all the items processed so far, connected by OR operators ('|'). In this example, each filter concatenated by '|' is a simple value, but it might be an arbitrarily complex filter expression.
Thanks mabl4367 a lot, infact a million.
As a newbie to nav spend a lot of time running towards this issue. Finally!!!