Welcome! Log In Create A New Profile

Advanced

Import data from DBF

Posted by ICI 
ICI
Import data from DBF
April 12, 2009 10:38PM
Is it possible to import data from external DBF into HF table???

DBF is most used format but there is no much documentation into WinDev help about this type of problem. Many developers when switch into WinDev have this type of problem. Maybe someone can write some example into WinDev solutions to help us little bit.
WinDev normally import DBF table and converrt data into HF but there is no documentation about how to do that at runtime from application. Functions for that are there but not documented well.

Something like this is not possible (Is there any macro symbol or what?)
HDBOpen("KOMITENTI","KO","C:\IMPORT\fin\F001\KOMITENT.DBF")

WHILE NOT HOut("KO")
HFKomitenti.KOM_SIF = "KO.KOM_SIF"
HAdd(HFKomitenti)
HReadNext("KO")
END

Sorry for previous two same posts. After my post forum is report about Error about sending my question and I am try few times. smiling smiley) My fault. Other two can be deleted.



Edited 2 time(s). Last edit at 04/12/2009 10:57PM by ICI.
Al
Re: Import data from DBF
April 13, 2009 04:35AM
Hello ICI

You have to read each record from the dbf file into the buffer
Try something like this code

MainFile is string = "FASSETS"
DBRecRead is int = 1

HDBOpen("PLTNEW","X1",ReadinDir+"PLTNEW.dbf")
DBRecCount is int = HNbRec("PLTNEW",hStateAll)
FOR DBRecRead = 1 TO DBRecCount
HRead("PLTNEW",DBRecRead)
HReset(MainFile)
FA.FACode = x1.plant_code
FAssets.Description = x1.descrip
FAssets.PurchaseDate = x1.purch_date
FAssets.PurchaseCost = x1.purch_cost
Hadd(MainFile)
END //for read all records


Regards
Al
ICI
Re: Import data from DBF
April 13, 2009 07:02AM
AI
Thank you very much. Your answer work very well but with some little change.
X1 is always "unknown or inaccessible" but
{"X1"+".plant_code"} work great smiling smiley

This is very usable code !
Code like this MUST be in WinDev Solutions. I will try to implement some little project when I finish my procedures for importing to enable all new similar questions to be answered automatically. Thank you again. You help me a lot.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: