Hi Nav Masters,
I have a question
My client want to export Inventory balance per Location.
I'm able to do it with a Dataport with DataItem "Item"
And onBeforeExportRecord i just CALCFIELD the Inventory.
My question is, if i have more than 1 location, i just filter per location, but the problem is one item code only write once, how to make dataport write 1 line per location. I want to loop for all location for every item code.
I know we can do it another way with Report, by writing manually to a file.
But can a dataport do it?
Thanks in advance
______________
Regards,
Steven
0
Comments
But for me it is faster to create report and write the data through FILE variable. It will be easier...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Rgds,
Jon.
Jon.
in NAV 4 SP3 you can indent tables in a dataport as when designing reports (i believe this is a new feature of version 4).
so, you can insert Location table before Item table, and then indent Item table to Location. the bad news are that you must set filters manually, but this way seems to be better than designing a report or programming a loop... or even "copy-pasteing" ( ) in excel
make sure the fields you are calculating are filtered by location
regards
so far, so good
Really??
http://www.BiloBeauty.com
http://www.autismspeaks.org
I wouldn't use it.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
The other option is to run a Physical Inventory Journal -> Calculate Inventory. It doesn't calculate inventory by Lot/Serial No. though.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Because It's not good enough?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Why not? The requester asked to export items by location. Stockkeeping Unit does this without complex programming.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
What if the client uses version 3.7? The code you posted will not compile, so I guess we can keep asking "what if" until our fingers get tired.
I guess it's different approach to addressing the problem. I prefer programming as the last possible alternative.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
I provided the example for people who have been asking on how to indent and instead they can use temporary record to calculate their data and then export using integer dataitem.
Also the thread was going to long and I just wanted to finish it.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I'm thinking of using a dataport because i thought theres an easy way to do it. But after i read this thread i think the easiest way is to create a report to write to FILE.
Thanks ara3n for the code example.
And Thanks to All for the ideas, I really appreciate it.
Regards,
Steven
What if you have no chance to run the code logic within Navision (Outside of Navision)? I ever faced the problme when I was trying to build a mobile client which need to extract Inventory by Location from C/SIDE SQL db directly. I solve it by simply querying the SIFT table through something like ADO. Because whatever you do in Navision, finally it still needs to go to the right SIFT table. I mean if you want to use CALCFILEDS function in stead of crazy SUM, Off course , it's just for SQL db. Maybe C/FRONT or C/ODBC can be used for Native DB too. Anyway, it's just another idea for some special cases when you need to retrieve that information outside of Navision.
Regards
MCP - MBS Navision
jle@naviworld.com
I usually create a query with SUM and grouping. Is there any other easier way?
Thanks
Regards,
Steven
Within Navision, your way is the easiest way, and also ara3n and Alex Chow have provided very nice ideas. They all works
As I said my idea is for the cases when you can't do it within C/SIDE. Especially when you want to integrate few systems then you have to do it outside and there is a possibility to use ADO query the SQL SIFT table and probably this is the fastest way in that case. Otherwise my idea will make things more complicated if you can do it in Navision. For how to use ADO you need to spend a little bit time to tabke look at it, the fellows here have post very uesful articles including sample codes on this forum. For SIFT you need to find the proper information from Navision Application Design Guide or Navision Certification courseware. Then you will know how it works
Good Luck
MCP - MBS Navision
jle@naviworld.com