
export table in a TXT with fixed length
export table in a TXT with fixed length
Hi DataEase, we have a problem when we try to export a file into a TXT file that MUST have a fixed length. It means that each fields of the output record have a specific length. It happens that sometimes on some fields DataEase does not respect the length of the field indicated into .ITEMS inserting additional blank to the field. Have you any idea or suggestion on this ? Here the DQL.
for CIN_Record_AU with Dichiarante = AIS ;
list records
Identificativo ;
Codice Fiscale ;
Flag_abilitazione_codfis_stampa ;
Codice_fiscale_per_stampa ;
DENOMINAZ. O COGNOME ;
Nome ;
Cittadinanza ;
Partita Iva ;
Sesso ;
Data_di_nascita ;
Comune_di_nascita ;
Res.Anag-Indirizzo ;
Res.Anag-Comune ;
Res.Anag-CAP ;
Res.Anag-Telefono_Prefisso ;
Res.Anag-Telefono_Numero ;
Res.Anag-Fax_Prefisso ;
Res.Anag-Fax_Numero ;
Dom.Fisc-Indirizzo ;
Dom.Fisc-Comune ;
Dom.Fisc-CAP ;
Dom.Fisc-Tel.Prefisso ;
Dom.Fisc-Tel.Numero ;
Dom.Fisc-Fax Prefisso ;
Dom.Fisc-Fax Numero ;
Ubic.Att-Indirizzo ;
Ubic.Att-Comune ;
Ubic.Att-CAP ;
Ubic.Att-Telefono_Prefisso ;
Ubic.Att-Telefono_Numero ;
Ubic.Att-Fax_Prefisso ;
Ubic.Att-Fax_Numero ;
Codice_Attivita_2007 ;
Codice_attivita_2004 ;
Descrizione_Codice_attivita_2004 ;
Codice_attivita_1993 ;
Descrizione_Codice_attivita_1993 ;
Societa_non_operativa ;
Artigiano ;
Indirizzo_e-mail ;
Rappr.Codice Fiscale ;
Rappr.Cognome ;
Rappr.Nome ;
Rappr.Data Nascita ;
Rappr.Sesso ;
Rappr.Comune Nascita ;
Rappr.Indirizzo ;
Rappr.Comune ;
Rappr.CAP ;
Rappr.Prefisso ;
Rappr.Telefono ;
Studio-Scritture_contabili_presso_studio ;
Studio-Codice_fiscale ;
Studio-Cognome ;
Studio-Nome ;
Studio-Indirizzo ;
Studio-Comune ;
Studio-CAP ;
Studio-Prefisso ;
Studio-Telefono ;
Studio-Note ;
Termine_legale_o_statuario_appr_bilancio ;
Capitale_sociale_in_Lire ;
Capitale_sociale_in_Euro ;
Codice_banca ;
Codice_regione_provincia_autonoma ;
N.CC.PP._Concessione ;
Concessione_di ;
Cod_Concessione ;
Amministrazione_dello_Stato ;
Num_iscrizione_registro_imprese ;
Num_iscrizione_CCIAA ;
Data_iscrizione_CCIAA ;
AnnoEuro-Contabilità ;
AnnoEuro-Delega F24 ;
AnnoEuro-770 ContInd ;
AnnoEuro-IVA ;
AnnoEuro-Redditi ;
AnnoEuro-Fatturaz ;
AnnoEuro-Linea Lavoro ;
ISO-Dati_anagrafici ;
ISO-Dati_rappresentante ;
ISO-Residenza_anagrafica ;
ISO-Domicilio_Fiscale ;
ISO-Ubicazione_attivita .
end
---
export to "W:\Cauz\Anagrafe_Tributaria\CIN_RecordAU.txt" .
.items
@f[1,1,3]@f[1,2,16]@f[1,3,1]@f[1,4,16]@f[1,5,40]@f[1,6,25]@f[1,7,4]@f[1,8,11]@f[1,9,1]@f[1,10,8]@f[1,11,25]@f[1,12,35]@f[1,13,25]@f[1,14,5]@f[1,15,4]@f[1,16,10]@f[1,17,4]@f[1,18,10]@f[1,19,35]@f[1,20,25]@f[1,21,5]@f[1,22,4]@f[1,23,10]@f[1,24,4]@f[1,25,10]@f[1,26,35]@f[1,27,25]@f[1,28,5]@f[1,29,4]@f[1,30,10]@f[1,31,4]@f[1,32,10]@f[1,33,6]@f[1,34,5]@f[1,35,35]@f[1,36,5]@f[1,37,35]@f[1,38,1]@f[1,39,1]@f[1,40,58]@f[1,41,16]@f[1,42,40]@f[1,43,40]@f[1,44,8]@f[1,45,1]@f[1,46,40]@f[1,47,40]@f[1,48,30]@f[1,49,5]@f[1,50,4]@f[1,51,10]@f[1,52,1]@f[1,53,16]@f[1,54,30]@f[1,55,35]@f[1,56,30]@f[1,57,30]@f[1,58,5]@f[1,59,4]@f[1,60,10]@f[1,61,40]@f[1,62,8]@f[1,63,12]@f[1,64,12]@f[1,65,4]@f[1,66,2]@f[1,67,10]@f[1,68,34]@f[1,69,3]@f[1,70,1]@f[1,71,11]@f[1,72,10]@f[1,73,8]@f[1,74,4]@f[1,75,4]@f[1,76,4]@f[1,77,4]@f[1,78,4]@f[1,79,4]@f[1,80,4]@f[1,81,2]@f[1,82,2]@f[1,83,2]@f[1,84,2]@f[1,85,2]
.end
Re:export table in a TXT with fixed length
We are sorry but this is not something that we can test or check out. We take your word for it, but this DQL is pushing the envelop for this functionality.
Re:export table in a TXT with fixed length
Sounds like you have a bug carried over from and introduced in DataEase 7, it's the reason I have 7 databases still on dataease 6.52. The bug was reported but the old dataease team ignored it.
I've not tried it yet in 8 as so far i've just upgraded a database that doesn't use fixed length exports. The issue I had like you was DataEase ADDING a space to fixed length character exports. I did find it only did it to a specific field type, can't remember which now but it was something to do with ONE type of number field, i.e.. numeric string, variable length number, sequenced id etc. Have a play with exporting different types of number fields to find which one it is.
Re:Re:export table in a TXT with fixed length
It was a long time ago now so can't look up my findings on the old forum. It might have been all fields now i think, i think what i found was spaces were added to FIXEd length fields, but not to variable length. My only historical notes on this that don;t tell me anything now lol, are:
Jan2010 was issue in 7.x
DE7 can't export text without screwing it up and adding extra spaces.
Re:Re:Re:export table in a TXT with fixed length
Simplicity does it. It is no point sending us long DQL's without an application. We need a clue, as we can't replicate every possible and impossible problem.
Simons clue gave us a lead, and the export function gets it wrong.
Memo is far out, so forget about that in total.
But the problem is Number fields.
The rest seem to get it right, so the bet is on it not excluding spacers for thousands or something like that.
This was our DQL:
for SomeData ;
list records
Text40 ;
NumericString ;
Number5.2 ;
Currency5.2 ;
Date ;
Time ;
YesNo ;
ChoiceList ;
Memo .
end
export to "testexp.txt" .
.items
@f[1,1,20]|@f[1,2,20]|@f[1,3,20]|@f[1,4,20]|@f[1,5,20]|@f[1,6,20]|@f[1,7,20]|@f[1,8,20]|@f[1,9,20]|
.end
Re:Re:Re:Re:export table in a TXT with fixed length
As it is number fields and memo fields that has problems (one way or the other), simply convert them to text before exporting them and they will be fine.
The DQL now looks like this:
for SomeData ;
list records
Text40 ;
NumericString ;
totext(Number5.2) ;
toText(Currency5.2) ;
Date ;
Time ;
YesNo ;
ChoiceList ;
firstc(Memo,20) .
end
export to "testexp.txt" .
.items
@f[1,1,20]|@f[1,2,20]|@f[1,3,20]|@f[1,4,20]|@f[1,5,20]|@f[1,6,20]|@f[1,7,20]|@f[1,8,20]|@f[1,9,20]|
.end
Re:Re:Re:Re:Re:export table in a TXT with fixed length
No. My table has only text and numeric string fields. Anyway I've tried to use ToText()on the export-dql also on the numeric string fields but the problems remains unchanged.
Re:Re:Re:Re:Re:export table in a TXT with fixed length
Mr DataEase: I'm glad I gave you a clue and got you on the right track, even more glad you found it, maybe my memory is better thasn i thought :D
Marco: Do what I did back in 2010 and note all fields that are adding a space, then look at the tabel and see if there is a pattern with these fields (all 6.4 numbers, all floating decimal numbers, all high values, all fields that sometimes contain a minus figure etc).
Also create a new export and just export 2 of the problem fields on there own. Have a play and see if the same happens.
Look for something as silly as a fixed length of 20 characters, but maybe you missed a select records that are only holding a 19 digit number etc.
Breaking a big problem in to something smaller sometimes helps you to focus and find a cause.
Re:Re:Re:Re:Re:export table in a TXT with fixed length
Mr DataEase: I'm glad I gave you a clue and got you on the right track, even more glad you found it, maybe my memory is better thasn i thought :D
Marco: Do what I did back in 2010 and note all fields that are adding a space, then look at the tabel and see if there is a pattern with these fields (all 6.4 numbers, all floating decimal numbers, all high values, all fields that sometimes contain a minus figure etc).
Also create a new export and just export 2 of the problem fields on there own. Have a play and see if the same happens.
Look for something as silly as a fixed length of 20 characters, but maybe you missed a select records that are only holding a 19 digit number etc.
Breaking a big problem in to something smaller sometimes helps you to focus and find a cause.