Data import from Access  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Data import from Access

Postby pricerc » Wed May 29, 2019 8:04 am

in ye olde days, one could do an inventory master import from an Access database.

Is there similar functionality lurking somewhere in Jiwa 7 that I haven't spotted yet, or do I need to do a new one?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Data import from Access

Postby pricerc » Fri May 31, 2019 8:19 am

So, after discussing this with the customer, and seeing what they're doing with their Access import (which they use regularly), It turns out that they add new product sets by keying/pasting them into a temporary table in Access, then they run some scripts to update another table, and then they run the Jiwa import tool to load the data from their 'jiwa_data_load' table.

All a lot of work.

So I figured that it might be better if I implemented a plugin that allows them to just paste data into a grid for importing.

I've got some old code that allows for loading and editing an Excel spreadsheet into a JiwaGrid for pricing updates, so I've tried adapting that to provide a blank template into which data can be either typed or pasted. I've got it working up to the point where I have a header row, and a data entry row. But it doesn't add new rows, and if I delete the one I have, then I have no new ones.

Is there a trick to enabling this?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Data import from Access

Postby SBarnes » Wed Jun 12, 2019 6:50 pm

Hi Ryan,

Without seeing the code it's pretty hard to comment but usually what I've done in any custom screen with the Jiwa Grid is that I have had a Jiwa Collection behind the screens with usually my own collection item in it and then add an empty object to the collection to then be the last line in the grid, then you just need to attach to the gird change event to capture columns / properties be set.

I am pretty sure Mikes List mainteance plugin is where I worked out how to do it https://forums.jiwa.com.au/viewtopic.php?f=27&t=498

Then I usually include a drawlines function which loops and calls a drawline function to display the grid, a lot of the Jiwa forms themselves apply this methodology. If you need a library to read excel and not use the grid to do it take a look at EPPlus which will work as an embedded reference and is fairly easy to use.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1618
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Data import from Access  Topic is solved

Postby pricerc » Fri Jun 14, 2019 6:07 pm

Here's my effort. I don't like the name, but that's what it is for now.

I've removed some of my other plugin references to make it standalone. You will need to add the form to menu somewhere to be useful - I chose Inventory/Utilities.

I'm reasonably happy with it, but it will need some site-specific customisation for anywhere else (like additional fields that my customer isn't using).

I went through a fair bit of weirdness, even mocking up some stuff using a small Windows App and a vanilla DataGridView, until I figured out that a 'data-bindable' collection worked quite well, but I still needed some logic around the 'empty' row for new data.

For the actual loading, I opted to create an XML document in code, and then load that. It saved me having to deal with a whole lot of logic that the inventory business objects do for me when they deserialize an XML object !
Attachments
Plugin Inventory Import Spreadsheet.xml
(75.09 KiB) Downloaded 62 times
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron