I use this function regular in some apps.
It would be great if it can be possible that we add a 2 dim. array that would/could change the headers in the excel file in order to match these of the dbf.
The dbf fields are defined, but the exels that I get are always differend than the dbf.
The sollution maybe :
aStruct := {}
DBF EXEL COLUMN
AADD(aStruct, { "Code" , "art_nummer"}) // link to Code
AADD(aStruct, { "Code" , "art_code"}) // Also link to code : there can be many more options to link to the dbf field (code)
AADD(aStruct, { "Datum" , "Datums"})
AADD(aStruct, { "Aantal" , "Quantity"})
AADD(aStruct, { "Aantal" , "menge"})
.....
The idea is that I fill the 2 dim array with Xbrowse data and past it to the FW_execltodbf
So, it will need to check if a value (2de argument = exelheader) exsist in the array in order to see if it is there. If so it needs to take the 1st argument and use that as the new header.
So several exel files could have a header colums that would link to 1 dbf field (code) in this example.
Exel headers that a not found may be omidded or just keep the exel header. The conversion will only keep the corresponding field names.
Exel = "Art_nummer, datums,menge" and would convert like
DBF = "Code,datum,aantal"
Can this be done ???
FW_ExcelToDBF to be extended (enhanced)
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: FW_ExcelToDBF to be extended (enhanced)
Good suggestion.
We will provide this in our next version.
We will provide this in our next version.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExcelToDBF to be extended (enhanced)
Mr. Rao,
Will it be in the new version that is upcomming ?
Thanks...
Will it be in the new version that is upcomming ?
Thanks...
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: FW_ExcelToDBF to be extended (enhanced)
FWH2102
Array can be
FW_ExcelToDBF() --> lSuccess
Writes the contents of excel range to default alias.
Parameters:
1. [oRange] Defaults to used range in active worksheet if already open by the user.
2. [cFieldList]
a) NIL:
( i) If range has headers in first row: Copies contents of each column to
the field whose name is same as the header of the column. Skips when
no match is found.
(ii) If range has no headers:
Copies contents of excel columns from left to right into fields 1 to last.
- Char: Should be a comma delemited list of field names of the dbf.
( i) If range has headers in first row: Copies contents of columns with header
maching the contents of the list to fields with the same name. Skips when
no match is found.
(ii) If range has no headers:
Copies contents of excel columns from left to right into fields contained
in the list. Skips in case of no match.
- Two-dimensional array: First element of each item contains the field name and
the second element contains the corresponding header in the excel range or
number of the excel column or alpha-column number like "A", "C", "AB", etc.
3) [lHasHeaders]
- .T.: First row of the range is treated as headers and data is from 2nd row
- .F.: The sheet does not have any headers and all rows are treated as data.
- NIL: The function examines contents of 1st and 2nd rows, If 1st row contains
all character values and 2nd row contains atleast one non-characer value,
lHasHeaders defaults to .T.
Array can be
Code: Select all | Expand
{ { "FIELD1", "header3" }, { "FIELD5", "header2" }, ... }
{ { "FIELD1", "C" }, { "FIELD5", "B" }, ... }
{ { "FIELD1", 3 }, { "field5", 2 }, ... }
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExcelToDBF to be extended (enhanced)
Thank you very much !! This is very helpfull in my situation
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour