Skip to main content

Importing multiple text/csv files without using the RDF file.

Hello Everyone
 
I hope all is well.
 
Is it possible to import many text or csv files at once without using the RDF file?
 
The resean im asking this qeustion is because, I have been trying to import multiple text files into IDEA, however, they come out incorrectlly, due to each file having a different number of fields. For an example, I have  different text files with 10, 6, 12. 3, 20, 150 etc fields. So, if I create the RDF file using a file with 3 fields, and then import all files using that RDF, what happens is that all files will only contain 3 fields after importing into IDEA. Is there a way to avoid this situation. Ideally, IDEA should import each file as a unique file with its own and correct number of fileds and related data, as an accurate copy of an original data file.
 
If there is a way to work around this, please kindly assist.
 
Thank you.
 
Smiso.

Smiso Wed, 01/22/2020 - 04:18

In reply to by scotchy33

Hi Scott
 
Thank you very much for your response.
 
I have tested the script and i dont think its working. I ran the script using just two files and i recieved the attached error message. Please advise if i may be missing something.
 
I tried every possible scenario that may make the script not work, in terms of he delimiter and the encapsulator, however, nohing worked. Please test on your side as well, to see if we get the same results.
 
Regards.

scotchy33 Tue, 02/04/2020 - 13:03

Hi Smiso,
The script was successful with the test files you sent me.
The script should automatically detect delimiter in files and also if there is encapsulation.
Scott

avikerem Fri, 02/07/2020 - 04:08

Hi
Using the idea "Desktop" function one can create a database from a txt or csv file without providing RDF mask. the "desktop" function will detect all fields, delimited by comma or tab, and will create a database with field names CHAR1 to CHARn and will also create an RDF mask for the imported file. In this case the newborn RDF file will have the name of the created database
Howevere when trying to use the macro Client.ImportDelimFile seems that this function does not support ommitted RDF file.
Is RDF file parameter mandatory?
If this is the case and RDF file is mandatory for client.ImportDelimFile, is there a macro workaround to import a file of type txt or csv when the name of the file is provided to the macro only at run time?
Thanks a lot and have a wonderful weekend
Avi Kerem

avikerem Fri, 02/07/2020 - 08:16

Two comments
1. I am using IDEA version 10.3 but I am not sure 10.4 will help since I am not interested at all in the RDF file, all I need is that the imported file will be imported preserving the field structure as defined by the .txt (tab delimited) or .csv (comma separated)
2. my current workaround is to create an rdf file with a specific name like "Generic" with enough fields to cover for the widest possible  input file and after the import to rename create correct field names and remove extra fields for each specific file imported. this is painful and kludgy...