[WD] App to export data

Startbeitrag von RAUL2 am 26.06.2013 16:19

Hi guys. I actually would like to ask for your advice regarding this requirement.

A client needs an app for opening Excel books and exporting that data in text files. The text files must be generated according to an structure. Until now, nothing weird. Thing is that Excel sheets can contain any number of columns and the generated text files can have any structure. So, I need to write an app capable of allow the user to set some stuff on the exported text files, for instance:

* delimiter.
* columns to be exported.
* width of those columns.
* if numeric data, sometimes, spaces must be filled with "0".
* and so on...

I remember that old Access has a simple wizard to do things like this. Well, I think I need to do something like that.

I will search de WD examples, but, do you know if there's a class or component or some piece of code doing something like this I need?

Any advice about this?

Thanks in advance. Kind regards.


Hi Raul

there are 3 parts in your problem, as I see it:
- read data from excel. You can do that with xls functions or OLE automation, depending if the process will always be done on a machine where excel is installed or not, and also of course if some exotic cases in the excel spread sheet may exceed the capacities of the xls functions... Both these techniques have help pages and examples available.
- write data in a text file, which is quite easily done, with my preference going to creating the content in a string in memory and then write the file with a fsaveText (faster this way)
- and in the middle, you have the whole settings management, which is in my opinion the most complex part... If files with the same structure have to be processed multiple times, then you need to store your setting in a DB, with a file to describe each import, and one to describe each column of each import... And it's there, depending on all the things that can/should be done to "massage" the data, that resides the complexity...

So for that, you have to consider:
- if the order of columns is the same in the in and out files or not
- all the type of data transformation that may be required (date management, prefixing with zeros, caps modifications, adding quotes around columns, removing them, replacing LF by a string, changing unicode to ansi, and anything more exotic...). This can be solved with a list of available functions with parameters (by example, PrefixO(8), with 8 being the number of positions), but that implies developping more each time a new need comes to life, AND/OR with the possibility to record a script (in wlanguage) that will be 'played' using the "compile" instruction, each time a specific column has to be managed...

And yes, I had one of those to write a few years back, and it included the management of any number of CR inside the text columns, which was quite a mess to deal with...

Best regards

von Fabrice Harari - am 26.06.2013 18:08
Thanks a lot, Fabrice, for your valuable remarks. In the next days coming up, I will start to design the app, mostly based in your comments. I agree with all of them.

Best regards.

von RAUL2 - am 28.06.2013 20:28
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.