Bin Contents Filtering Question

thetallbloke
Member Posts: 66
Hi All,
I'm trying to find the best way to filter the "Bin Content" table..
I have added a field called "Prev Qty" to the table and I want to store a value in it and then update all the ones that have changed..
Here is my code...
I'm not quite sure how or where to put the CALCFIELDS line... Does CALCFIELDS calculate every record at once and therefore am I doing it 4000+ times for every record...??? or does the CALCFIELDS only do the current record..???
I've found that if I take the middle few lines and just have the following code:
What I'd really like to do is have something like:
So that the CALCFIELDS and the Filter return <20 records depending on the system activity, etc...
When I ran the code just above the Quantity field is not calculated and every record is being updated...
Any suggestions would be much appreciated..
My Bin Content table has about 4300 records in it.. 2-3 seconds a normal amount of time to run this code..??
Thanks..
I'm trying to find the best way to filter the "Bin Content" table..
I have added a field called "Prev Qty" to the table and I want to store a value in it and then update all the ones that have changed..
Here is my code...
IF rBinContents.FINDSET THEN REPEAT rBinContents.CALCFIELDS(Quantity); IF rBinContents.Quantity <> rBinContents."Prev Qty" THEN BEGIN rBinContents.VALIDATE("Prev Qty", rBinContents.Quantity); rBinContents.MODIFY(TRUE); END; UNTIL rBinContents.NEXT = 0;
I'm not quite sure how or where to put the CALCFIELDS line... Does CALCFIELDS calculate every record at once and therefore am I doing it 4000+ times for every record...??? or does the CALCFIELDS only do the current record..???
I've found that if I take the middle few lines and just have the following code:
IF rBinContents.FINDSET THEN REPEAT rBinContents.CALCFIELDS(Quantity); END; UNTIL rBinContents.NEXT = 0;It takes a number of seconds.. only about 2 or 3 but that seems a long time to me...
What I'd really like to do is have something like:
rBinContents.CALCFIELDS(Quantity); rBinContents.SETFILTER(Quantity, '<>%1', rBinContents."Prev Qty"); IF rBinContents.FINDSET THEN REPEAT rBinContents.VALIDATE("Prev Qty", rBinContents.Quantity); rBinContents.MODIFY(TRUE); UNTIL rBinContents.NEXT = 0;
So that the CALCFIELDS and the Filter return <20 records depending on the system activity, etc...
When I ran the code just above the Quantity field is not calculated and every record is being updated...
Any suggestions would be much appreciated..
My Bin Content table has about 4300 records in it.. 2-3 seconds a normal amount of time to run this code..??
Thanks..
.
I'm not crazy !!! Just ask my toaster...
.
I'm not crazy !!! Just ask my toaster...
.
0
Comments
-
Your only choice in CAL is
IF rBinContents.FINDSET THEN REPEAT rBinContents.CALCFIELDS(Quantity); IF rBinContents.Quantity <> rBinContents."Prev Qty" THEN BEGIN rBinContents.VALIDATE("Prev Qty", rBinContents.Quantity); rBinContents.MODIFY(TRUE); END; UNTIL rBinContents.NEXT = 0;
Calcfields calculates one record at a time. That is why it has to be in the repeal loop.
You can use ADO and write your own sql statement is another option.0 -
[If you found the reply to your question, why not post it? You may help others that way.]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
thetallbloke wrote:I have added a field called "Prev Qty" to the table and I want to store a value in it and then update all the ones that have changed..
What is the "Prev Qty" field supposed to be?Regards,
Andwian0 -
Hi,
The Quantity field is a calculated field, so I was going to store the quantity value that was calculated at a point in time in that field, then next time, compare the calculated version against the physical value in "Prev Qty", and therefore determine which values have changed..
A very clunky, slow way to do it...
It was all too messy... and I decided to scrap that idea....
I'm not crazy !!! Just ask my toaster...
.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions