Pass flowfilters as parameter

QuivelusQuivelus Member Posts: 24
Hi all,

It seems as only 3 flowfilters can be passed as parameter. When working with version 5.00 on a SQL Server, I need to pass 4 flowfilters as parameter to filter on an entry table. The reason why we pass 4 different parameters and not a record variable, is because we need the function to be called for different tables. See example code (not the code I have, but simplified to show what causes the error). When we try the function with only 3 flowfilters (no mather which ones), no error is shown by Navision. Anyone a clue?
// Function: OnRun()
Fct_CalcItem(Lrec_Item);  // Fails
Fct_CalcProductGroup(Lrec_ProductGroup);  // Succeeds
Fct_CalcItemCategory(Lrec_ItemCategory);  // Succeeds

// Function: fct_ApplyFilters(VAR Prec_ItemLedgerEntry : Record "Item Ledger Entry";Ptxt_LocationFilter : Text[250];Ptxt_VariantFilter : Text[250];P
IF Ptxt_LocationFilter <> '' THEN
  Prec_ItemLedgerEntry.SETFILTER("Location Code", Ptxt_LocationFilter);
IF Ptxt_VariantFilter <> '' THEN
  Prec_ItemLedgerEntry.SETFILTER("Variant Code", Ptxt_VariantFilter);
IF Ptxt_LotNoFilter <> '' THEN
  Prec_ItemLedgerEntry.SETFILTER("Lot No.", Ptxt_LotNoFilter);
IF Ptxt_SerialNoFilter <> '' THEN
  Prec_ItemLedgerEntry.SETFILTER("Serial No.", Ptxt_SerialNoFilter);

// Function: Fct_CalcItem(VAR Prec_Item : Record Item)
// fct_ApplyFilters throws the error shown below
fct_ApplyFilters(Lrec_ItemLedgerEntry,
    Prec_Item.GETFILTER("Location Filter"), Prec_Item.GETFILTER("Variant Filter"),
    Prec_Item.GETFILTER("Lot No. Filter"), Prec_Item.GETFILTER("Serial No. Filter"));

// Function: Fct_CalcProductGroup(VAR Prec_ProductGroup : Record "Product Group")
fct_ApplyFilters(Lrec_ItemLedgerEntry, Prec_ProductGroup.GETFILTER("Location Filter"), '', '', '');

// Function: Fct_CalcItemCategory(VAR Prec_ItemCategory : Record "Item Category")
fct_ApplyFilters(Lrec_ItemLedgerEntry, Prec_ItemCategory.GETFILTER("Location Filter"), '', '', '');

Error I receive =
There is not sufficient available space in the C/AL stack memory to execute this task.
There are too many simultanious activities, due to the way recursive function call is used in the program. The problem can be solved temporarily by shutting down some of the open activities (but the function still cannot be executed).

It must be notices that I do not seem to use recursion..
Bohr-ing.

Answers

  • krikikriki Member, Moderator Posts: 9,110
    Instead of putting the GETFILTER directly in the function call, create local text variables and put the GETFILTER in those and then call the functions with your local variables.

    The error you had, can also occur when your function-call is to complicated because you too many other function calls in that function-call.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JedrzejTJedrzejT Member Posts: 267
    Just lucky shoot (because i don't know this error)
    1.Try use one parameter with 4 dimension to pass txt filters, instead of 4 parameters
    2.set filters on rec before pass Rec Varaible to function and pass only rec.
  • QuivelusQuivelus Member Posts: 24
    Dear Kriki,

    Thanks for your reply. I needed to know why this was not possible in Navision, because I could not find any information concerning the use of function calls as parameter. Also the Navision error did not help..

    With seperate variables, all works fine, but this is also much code.
    As a solution, I just used 4 times the setfilter code in eacht of my 3 functions, without the use of variables.
    I see this as solved.

    Thanks
    Bohr-ing.
Sign In or Register to comment.