You can generate indexes for use in calls to the function rec_fetch with the #index directive:
#index index_name,
index_name,
...
index_name; |
where index_name is the name of an index table or role that you wish to use with rec_fetch() or a similar function .
For example, if you use the directive:
#index supplier,
principal,alternative; |
You could call rec_fetch() to access materials by princial supplier number as follows:
if (rec_fetch(FIRST, &material.l, _SUPPLIER, _PRINCIPAL) > 0)
{
depth = 0;
do
{
map_draw(1,SCROLL);
if (depth==0)
showi(1,1,material.principal.supplier_number);
showc(1,2,material.material_code);
}
while (rec_fetch(NEXT, &material.l, _SUPPLIER, _PRINCIPAL) > 0);
}
|
and by alternative supplier number like this:
if (rec_fetch(FIRST, &material.l, _SUPPLIER, _ALTERNATIVE) > 0)
{
...
while (rec_fetch(NEXT, &material.l, _SUPPLIER, _ALTERNATIVE) > 0);
}
|
You can only use indexes that are shown with the Update property set in SETLINK. In fact the indexes shown in these examples are not turned on, so the code would fail with a system error.