Finding "the most recent record" from a subset of

johnsogj
Member Posts: 103
I'm trying to build a report that can look back through a subset of records already pulled and perform some actions based on values in the most recent record from that subset:
Here is what I’ve built so far:
1.I display a list of receipt records that meet a certain criteria.
2.Then I calculate the total quantity received across all of those records.
3.Then I compare that total quantity received to another value I’ve already calculated (total sold) to determine the Total Qty Remaining
Then I get stuck. Here is what I need to do next:
1.If the value from #3 above (Total Qty Remaining) is greater than zero, find quantity in the MOST RECENT receipt record from step #1
2.Subract the quantity in that most recent receipt record from the “Total Qty Remaining”,
3.If it is 0 or less, I’m done.
4.But if that quantity is greater than zero, go find the quantity in the NEXT MOST RECENT receipt record and repeat…
Can anyone help? Does anyone know of any functions that could be useful?
Thanks,
Molly
Here is what I’ve built so far:
1.I display a list of receipt records that meet a certain criteria.
2.Then I calculate the total quantity received across all of those records.
3.Then I compare that total quantity received to another value I’ve already calculated (total sold) to determine the Total Qty Remaining
Then I get stuck. Here is what I need to do next:
1.If the value from #3 above (Total Qty Remaining) is greater than zero, find quantity in the MOST RECENT receipt record from step #1
2.Subract the quantity in that most recent receipt record from the “Total Qty Remaining”,
3.If it is 0 or less, I’m done.
4.But if that quantity is greater than zero, go find the quantity in the NEXT MOST RECENT receipt record and repeat…
Can anyone help? Does anyone know of any functions that could be useful?
Thanks,
Molly
0
Comments
-
i hope i understand this.
when you run 1. you can store the needed datas into a temp. table.
then, on 3.x you go through these stored temporary records to find the record you need.
For an better understanding (my part) its good to see some code snippes.
regardsDo you make it right, it works too!0 -
It makes sense, but some sample code would definitely help. Do you know where I could see some? Or do you know of any documentation on how to build a temp table?0
-
as a temporary table you can use every table. in some cases (i think ever) its better to create your own table. these table you use as temporary table.
How to define a table in code as temporary:
create a recordvariable under Global variables or Local variables
name Type ID
TempTab record 27 //for example
Now go to the properties of these variabel. here you see the property temporary. So, datas in a temp. table are only in the client cache. But note: if you forgott to set the property temporary you work on the real table. So its better to create your own real table (like 50000 My Buffer) with some fields (integer, decimal, char, text, code, etc.) to use this as temorary table. So the distress is not so high, that you delete inadvertently the records in the real table.
regards.
PS: with code snippes i mean your codeDo you make it right, it works too!0 -
Thank you - now I understand how to create the temporary table - but how do I write my subset of receipt records to that table once I find them in the Purch. Rcpt. Line table?0
-
like you write data per code in other tables.
You are new on Nav :?: If yes, please, before you develop your own solutions, read the manual
Application Designer’s Guide (w1w1adg.pdf)Do you make it right, it works too!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