Page 1 of 1
Loading multiple files into a cube
Posted: Fri Dec 28, 2012 8:55 am
by beek
Hi there,
Happy New Year !
I have a situation here, and would like to seek for your opinion.
I have total of 13 files, loading into the same cube. With the differences, load into different Country, different Currency.
I'm thinking which way would be the better way to do this. I can either to have 13 differnt TI processes, or to have 1 single TI process, and let the user trigger the input (eg load the file 1 by 1).
Is there any other better way that I can do ?
The file I'm loading is Actual numbers for multiple countries, multiple currencies. The problem is that inside the dat file, there's no country nor the currency information. This is found only with the filename.. this is exactly why there are multiple files..
Has anyone have similar situation before? Can share with me?
Re: Loading multiple files into a cube
Posted: Fri Dec 28, 2012 12:33 pm
by mvaspal
Hi
or to have 1 single TI process, and let the user trigger the input (eg load the file 1 by 1)
Yes, this is a possible solution, in this case the user has to run the TI 13 times.
Or, you can write a simple 'master' TI that calls your original TI using ExecuteProcess 13 times with the file name, countries and currencies as parameters.
You can also embed the ExecuteProcess calls into a WHILE loop in the 'master' if you can find an algorithm for that (e.g. cycling through the elements in the country and currency dimensions).
Re: Loading multiple files into a cube
Posted: Wed Jan 02, 2013 1:00 am
by beek
Hi ,
THanks for suggestion. Can you tell me how can I pass in the filename as parameter, which in turn to be a data source for another TI process? Or maybe I can write a bat file, which is to be executed in a WHILE loop, which then copies the 1st dat file into a common .txt file, which this .txt file is the data source of the child TI, which will be called by the master TI..
Is this what you are suggesting?
Re: Loading multiple files into a cube
Posted: Wed Jan 02, 2013 2:32 am
by Alan Kirk
beek wrote:
THanks for suggestion. Can you tell me how can I pass in the filename as parameter, which in turn to be a data source for another TI process?
I'd point you to the manual for this but the TI manual is frapping awful when it comes to explaining how to create DIY processes.
This will only really work if all 13 files have the same columns. If they do, create a dummy file (one with the same structure as the real files and with at least a few rows of realistic data), and set that as your file source on the Data Source tab of a new process. This is only to allow you to work with something while you're writing your code; you can delete it when you're done.
Write the processing code on the Metadata and Data tabs as normal.
Now go to the Advanced tab, and go to the Parameters sub-tab below that.
Over on the right you will see a button titled [Insert] which allows you to add a parameter. The parameter can be either string or numeric. In your case you'll want it to be a string. This will be used to receive your filename. In all other respects it acts like a normal variable.
Set the
DataSourceNameForServer process variable to the value of your parameter in the Prolog tab. In this way every time the process is called, it will reassign the data source name to the value passed in to that parameter.
beek wrote:Or maybe I can write a bat file, which is to be executed in a WHILE loop, which then copies the 1st dat file into a common .txt file, which this .txt file is the data source of the child TI, which will be called by the master TI..
Is this what you are suggesting?
You're on the right track but there's no need to mess around with batch files.
Create a second process which is the Master process referred to in the earlier post. In the prolog tab you create a While loop to call the original process 13 times. Each call will be made using the
ExecuteProcess TI function, which allows you to pass parameters to the called process. See the help example via that link to see how that's done.
Re: Loading multiple files into a cube
Posted: Wed Jan 02, 2013 3:12 am
by beek
BIG thank you Alan. I understand now. will try that out ..
cheers,
Re: Loading multiple files into a cube
Posted: Wed Jan 02, 2013 12:50 pm
by BariAbdul
"BIG thank you Alan. I understand now. will try that out ..
If you figured it out ,Could you please share the script.Thanks
Re: Loading multiple files into a cube
Posted: Wed Jan 02, 2013 6:51 pm
by Alan Kirk
BariAbdul wrote:"BIG thank you Alan. I understand now. will try that out ..
If you figured it out ,Could you please share the script.Thanks
You
do realise that the actual script will be completely different for everyone depending on the structure of their cubes, the data in their files, etc,, yes? You won't be able to take the OP's TI process and run it on your own cubes.
The part of the process that relates to calling a second process repeatedly and having it process a different file each time is already described above, with links to the corresponding parts of the manual. The rest is going to be specific to your own setup.