COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS Transformer => Topic started by: smartpawn on 20 Jan 2009 03:13:10 AM

Title: Need help on data source & cubes
Post by: smartpawn on 20 Jan 2009 03:13:10 AM
Hi Friends,

I am new to Cognos so, need your help or suggestions to solve the following issue.

I have around 1000 csv files (which comes continuously from other application), like file1.csv, file2.csv, file3.csv ...... now, i have created a data source called 'test_data' for file1.csv and after indetifying metadata and measures, i have created its cube as well.

now, i want to feed remaining csv files to the same datasource so, that i can have the single data souce and cube at the end.

Is it possible?

If yes, then please suggest me how can i do it using some automated scripts.

If no, then please suggest me some alternative solution to handle this scenario.

Appreciate your detailed response!

Thanks in advance!

Regards,
-P
Title: Re: Need help on data source & cubes
Post by: JGirl on 30 Jan 2009 03:45:29 AM
Assuming that all 1000 of your CSV files contain the same data structure (ie the same columns, in the same order, containing the same data types), you should be able to use a windows script to browse through the directory, and concatenate the rows from all the files together into a single file which you could use as the single data source into transformer.

To create the windows script, open up notepad and type a copy command using the syntax   copy "sourcefilelocation" "destinationfilelocation"

eg. "C:\Data\Files\*.csv" "C:\Data\TOTALFILE.txt"

Save the file as something like ConcatenateFiles.bat.  Go to windows explorer, find the *.bat file you just created and double click it.

If you want to make if fancier you could check for the existing TOTALFILE.txt first, delete it if it already exists, and move the files you've copied into a separate location so that arent reprocessed next time but thats beyond my scripting knowledge and the answers will be somewhere on the internet!

Hope this helps.
J