Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 8 Jahren, 1 Monat
Letzter Beitrag:
vor 8 Jahren, 1 Monat
Beteiligte Autoren:
DarrenF, Toddy Utomo, Al, Alexandre Leclerc, Dan M

How do you import CSV data to an existing HFSQL table?

Startbeitrag von Dan M am 03.08.2009 12:28

I have a data file (table) called supplier inventory. We need to update it daily from several suppliers.

Sometimes the data is completely new, sometimes it is updates (quantities and prices change).

I need to append data (new records) and update data of existing records (such as quantity and price).

What are the functions I should be looking up in the help system to figure out how to do this?

What is the process?

Thanks ... Dan

Antworten:

Hi Dan,

See my example that imports to a Countries HF data file in the Windev Solutions forum on this Mysnip site:
http://forum.mysnip.de/read.php?27161,22800

Obviously, it's a different file but the technique is the same.

It doesn't do an update at the moment, so you'll need to do something like this - Hopefully, the file you receive will have a field that uniquely identifies an inventory item such as a SupplierID/ProductID for example. So, in the code within the FOR loop, you'll need to add a HReadxxx statement (which ever suits your purpose-probably HReadseek), and test IF the supplier/product combination exists in your HF Inventory file. If it exists then you'll just HModify the fields you need to (quanity & price?). However, if the product doesn't exist you'll want to HAdd the new Inventory.

Oh, and don't forget - you won't need the HCreation statement!

Hope this help...

von DarrenF - am 03.08.2009 12:51
Hi Dan,

HImportText is actually importing a CSV file. But if you need real sync. check how to do it in the help. See keyword "Replication" and maybe "Universal Replication".

I hope this helps.

von Alexandre Leclerc - am 03.08.2009 15:35
Hello Dan

Sometimes it is easier to open csv files in Excel, resave them as an xls file and then use the Windev Excel functions to handle them.

Regards
Al

von Al - am 03.08.2009 21:04
Hi,

Yes... sorry, I missed that step from my description above - I did the CSV to Excel conversion in my head... oops

My example works from an Excel format...

von DarrenF - am 03.08.2009 21:22
Hi Dan,

I put a solution how to import CSV data
see on:

http://forum.mysnip.de/read.php?27161,32540,32540#msg-32540

HTH
Toddy


von Toddy Utomo - am 04.08.2009 03:54
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.