Setfilter And Calcsum
steallo
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?
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?
0
Comments
-
//TempString := STRSUBSTNO('%1*%2', 'F', 'S'); TempString := STRSUBSTNO('%1|%2', 'F', 'S');
Try it like that, using an '|' instead of '*' in your filter.0 -
Nagi not like that

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 Patel0 -
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....0 -
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 F0
-
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 Patel0 -
I did it...
Enabled Key SumIndexFields
Yes Item No.,Posting Date,Location Code,Reason Code Quantity0 -
now u got an error ?Experience Makes Man Perfect....
Rajesh Patel0 -
I've already Did it....
If I did not decleared the key with sumindexfield i think the error was different....0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions