Author | Topic: Why DbExport doesn´t keep in mind Data Types Integer or Money? | |
---|---|---|
César Calvo | Why DbExport doesn´t keep in mind Data Types Integer or Money? on Sat, 19 Nov 2016 19:05:22 +0100 Hello. I don´t understand why DbExport doesn´t export data of fields type Integer or Money to CSV Please, Could anybody help me? Thanks. César. METHOD PROCESO CLASS PRUEBA LOCAL cRut, cDic, cUsu, cPas, cSer LOCAL oConStr, cConStr, oSes, aStr MenuSelect(ID_MNU_ESPERAR,SDI_VIEW_ESPERAR) AppReadIni( "SINFOGECO.INI" ) cRut := AppIni():GetEntry("DATA","DBF") cDic := AppIni():GetEntry("DATA","DIC") cUsu := AppIni():GetEntry("DATA","USU") cPas := AppIni():GetEntry("DATA","PAS") cSer := AppIni():GetEntry("DATA","SER") oConStr := dsConnectionString():new(";") oConStr:AddEntry("DBE","ADSDBE") oConStr:AddEntry("Server",cRut + cDic) oConStr:AddEntry("UID",cUsu) oConStr:AddEntry("PWD",cPas) oConStr:AddEntry("ServerType",cSer) cConStr := oConStr:GetConnectString() oSes := DacSession():New( cConStr ) IF .NOT. oSes:isConnected() ErrorBox( "No Conectado a ADS", {"Atento"} ) RETURN ELSE IF FExists("PRUEBA.csv") FErase("PRUEBA.csv") ENDIF DbeInfo( COMPONENT_DATA, DELDBE_RECORD_TOKEN, ";" + CHR(13)+CHR(10) ) DbeInfo( COMPONENT_DATA, DELDBE_DELIMITER_TOKEN,Chr(0) ) DbeInfo( COMPONENT_DATA, DELDBE_FIELD_TOKEN,"|" ) DbeInfo( COMPONENT_DATA, DELDBE_MODE,"DELDBE_MULTIFIELD") DbeInfo( COMPONENT_DATA, DBE_DATATYPES, "CDLN" ) USE ALBARANES VIA "ADSDBE" ALIAS PRU //aStr := DbStruct() //AEval( aStr, {|a| Infobox( a[DBS_NAME] + " - " + a[DBS_TYPE] )} ) DbExport("PRUEBA.csv",,,,100) CLOSE PRU oSes:disconnect() ENDIF MenuSelect(ID_MNU_CLOSE,SDI_VIEW_CLOSE) RETURN self | |
Andreas Gehrs-Pahl | Re: Why DbExport doesn´t keep in mind Data Types Integer or Money? on Sat, 19 Nov 2016 23:48:23 -0500 César, >I don´t understand why DbExport doesn´t export data of fields type Integer >or Money to CSV The following line: >DbeInfo(COMPONENT_DATA, DBE_DATATYPES, "CDLN") is not sensible at all. The DBE_DATATYPES define is a read-only feature, that will report the DBE's data types. It can't be used to set any values. Also, you do have the complete source code for the DbExport() function in the "...\Source\Runtime\Sys\dbbulk.prg" file, so you can see that this function filters out all the fields that are not of type "CDLN" -- the only field types that the DELDBE understands, in lines 229 to 236. You could simply use the DbExport() code and remove or modify that filter to work with the field types that you would like to use, or write your own export function, without all the overhead that comes with DbExport(). The simplest way would be to convert "I", "F", "S", and "Y" field types to "N" in that filter loop, rather than deleting those fields from the arrays. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
Andreas Gehrs-Pahl | Re: Why DbExport doesn´t keep in mind Data Types Integer or Money? on Sun, 20 Nov 2016 01:59:15 -0500 César, >Could you say me where change the code for to convert "I", "F", "S", >and "Y" field types to "N" in that filter loop, rather than deleting >those fields from the arrays? You could change the code between line 229 and 236 to something like this: if .not. aTarget[i, DBS_TYPE] $ cFieldTypes if DbeInfo(COMPONENT_DATA, DBE_NAME) == "DELDBE" .and. ; aTarget[i, DBS_TYPE] $ "IFSY" aTarget[i, DBS_TYPE] := "N" else ADel(aTarget, i) ADel(aFieldPos, i) endif i-- nCount-- endif Hope that helps. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
César Calvo | Re: Why DbExport doesn´t keep in mind Data Types Integer or Money? on Fri, 25 Nov 2016 08:23:27 +0100 Thanks Andreas, this is all I need. Regards. César. "Andreas Gehrs-Pahl" escribió en el mensaje de noticias:wudkp780did3.zz6eksokej8j$.dlg@40tude.net... César, >Could you say me where change the code for to convert "I", "F", "S", >and "Y" field types to "N" in that filter loop, rather than deleting >those fields from the arrays? You could change the code between line 229 and 236 to something like this: if .not. aTarget[i, DBS_TYPE] $ cFieldTypes if DbeInfo(COMPONENT_DATA, DBE_NAME) == "DELDBE" .and. ; aTarget[i, DBS_TYPE] $ "IFSY" aTarget[i, DBS_TYPE] := "N" else ADel(aTarget, i) ADel(aFieldPos, i) endif i-- nCount-- endif Hope that helps. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC |