Setfilter And Calcsum

steallosteallo Member Posts: 21
Good Morning all,
I'm working with Nav5.0 with sql server....

I've to calculate quantity on table Item Ledger Entry setting a filter on Location Code Field of this type: F*S

This is the code:

RecItemLedg.SETCURRENTKEY("Item No.", "Posting Date", "Location Code", "Reason Code");
RecItemLedg.SETRANGE("Item No.", RecGetto."Item No.");
RecItemLedg.SETRANGE("Posting Date", DateStart, DateEnd);
TempString := STRSUBSTNO('%1*%2', 'F', 'S');
RecItemLedg.SETFILTER("Location Code", TempString);
RecItemLedg.CALCSUMS(Quantity)

This Code Return an error, It can't calculate the sum of quantity because filter Cantains ? or *

C\SIDE Guide don't tell that CALCSUMS don't work with particular SETFILTER

Can you Help me please?

Comments

  • NagiNagi Member Posts: 151
    //TempString := STRSUBSTNO('%1*%2', 'F', 'S');
    TempString := STRSUBSTNO('%1|%2', 'F', 'S');
    

    Try it like that, using an '|' instead of '*' in your filter.
  • rajpatelbcarajpatelbca Member Posts: 178
    edited 2008-05-27
    Nagi not like that :mrgreen:

    Try this

    RecItemLedg.SETFILTER("Location Code", 'F*S');

    it should work.
    have you created a key "Item No.", "Posting Date", "Location Code", "Reason Code" ?
    have you add Quantity in sumindex field which is beside the key ?

    if not then add it.

    thanks,
    Experience Makes Man Perfect....
    Rajesh Patel
  • steallosteallo Member Posts: 21
    TempString := STRSUBSTNO('%1|%2', 'F', 'S')

    Sorry is not the filter that i have to do....

    News Update:

    IF I set the same filter on Item Card For Calculate inventory field pushing flow filter....Navision give the same error!

    I try it also on native DB

    Maybe is not possible....
  • steallosteallo Member Posts: 21
    rajpatelbca: doing that don't set the right filter....if you debug and look the table filter on record you'll see on location code only F
  • rajpatelbcarajpatelbca Member Posts: 178
    have you created a key "Item No.", "Posting Date", "Location Code", "Reason Code" ?
    have you add Quantity in sumindex field which is beside the key ?

    if not then add it.

    thanks,
    Experience Makes Man Perfect....
    Rajesh Patel
  • steallosteallo Member Posts: 21
    I did it...

    Enabled Key SumIndexFields
    Yes Item No.,Posting Date,Location Code,Reason Code Quantity
  • rajpatelbcarajpatelbca Member Posts: 178
    now u got an error ?
    Experience Makes Man Perfect....
    Rajesh Patel
  • steallosteallo Member Posts: 21
    I've already Did it....
    If I did not decleared the key with sumindexfield i think the error was different....
Sign In or Register to comment.