I have two recordsets filtered on different fields of an identical table.
Is it possible to have it copied to a third recordset with record source of that same table.
For eg. I have 2 Record Variable of Item table
ItemRec1 - Which is filtered on No. 1000
ItemRec2 - which is filtered on No. 1100
Now, what is the appropriate way to copy it to a third Record Variable ItemRec3
0
Comments
as I understand your problem, you need a record variable that includes both,
No. 1000 and No. 1100 is that correct ? :-k :-k
In order to achieve that, you do not need 3 instances of the same record variable, in fact, 1 record variable with an appropriate filter will do the same:
So, your global variable is:
ItemRec1 - Type is Record, Subtype is the Table you need
If you want that record variable to represent all Records in it where No. = 1000 and No. = 1100 you can do so by using:
ItemRec1.SETFILTER("No.", '%1 | %2', '1000', '1100');
Parameters:
"No." = the table field the filter is applied to
'%1 | %2' = the filter string, %1 and %2 are replaced by the parameters following, | is the logical OR
'1000' = replaces %1 on executing
'1100' = replaces %2 on executing
have a look at the C/SIDE reference in NAV, it shows the appropriate use of SETFILTER and its possibilities with |, &, .. etc.
Also, remember, when using the record variable later to retrieve its records 1 by 1 using FIND instead of GET, as FIND respects the setting of filters, which GET doesn't.
cheers,
manu
8)
Couldn't you just describe the business problem instead?
But if the records were filtering on different fields that weren't primary keys, and you wanted to "merge" the results, you would have to do things differenlty.
for instance you want all records where the gen. prod posting group = rawmat OR the inventory posting group = domestic
in this case, you have to declare to records variables, and set the filter on each. Then declare a third temp variable. You loop through both sets, and try to insert all of them into temp. For instance
This always you set "OR" filters between fields -- instead of cumulative filters the way standard navision does.