Cognos change datasource of existing package - cognos-10

I have a package that was exported from a Cognos 10.2.1. development server and imported into a new server. I now need to change the data source on that package on the new server but am unable to find where to do this.
Note, I cannot just add a new data source with the same name as the one currently specified in the package, because a data source with that name is already defined on the new server, but is not the data source that I need to use.

A quick and dirty method would be to export the package, open the file in a text editor, search for the name of connection, confirm that the reference is to the old connection, and replace the text with the new connection name.
Almost all objects in Cognos are stored as XML which makes them amenable to this method.

Related

Mapping Data Type for CSV files

Is it possible to save a mapping file which SSIS can use to decide the data type based on the column names rather than going and updating it in the Advanced section of the 'Flat File Connection Manager Editor'. Thank you
This is a common problem faced by every SSIS developer. Whenever you make changes in a flat file connection, you lose all data type mappings and you have to manually edit this by using the advanced editor.
But you can save your life using the following:
Practice #1
When you work with an existing connection, make sure you have the flat file at the reference location of the flat file connection with the same name. If you forget to save it or don't find it, try the second practice.
Practice #2
Follow the steps below before using the SSIS package:
Open package in XML file format.
Find the flat file connection.
Read the file name and path of flat file connection.
Get the output copy of the final output file (usually you can find where SSIS is exporting final output file).
Copy the final output file and rename with the file connection's file name and paste it to the flat file connection location.
Remove all the data from file except the column list (make sure you keep the file format as it is, e.g., CSV or Excel).
Close the XML of the SSIS package & close the package.
Reopen the SSIS package and you saved your life.
This trick works for me in all my cases.

Connection String to use Microsoft Text Driver with a preconfigured data source name

We are currently using the following connection string in a script to read a CSV via the Microsoft Text Driver:
myConn.ConnectionString= "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=O:\;Extensions=asc,csv,tab,txt;"
Instead of specifying the details to connect to the CSV in the code like we have done above, we want to use a data source name in the code.
I.e. a data source that would be configured on the 'System DSN' section of the ODBC snap on the workstation that the script is run in. This ODBC would have the required details linking it to the CSV.
For example: All users will have a Microsoft Text Driver ODBC with the name ODBC1 setup on their system, and we need to be able to refer to this data source name without putting in the actual details to connect to the CSV in the code.
Found it! All I needed to use a data source name in the code was to replace the code in the question with:
myConn.ConnectionString= "DSN=ODBC1;"

R dataset connection to tableau

Recently tableau gave the functionality of R connection in their release 8.1. I want to know if there is any way i can call an entire table created in R to tableau. Or an .rds object which contains the dataset into Tableau?
There is a tutorial on the Tableau website for this and a blog on r-bloggers which discuss. The tutorial has a number of comments and one of them (in early Dec I think) asks how to get an rds file in. You need to start Rserve and then execute a script on it to get your data.
Sorry I can't be more help as I only looked into it briefly and put it on the back-burner but if you get stuck they seem to come back quickly if you post a comment on the page:
http://www.tableausoftware.com/about/blog/2013/10/tableau-81-and-r-25327
Just pointing out that the Tableau Data Extract API might be useful here, even if the current version of R integration doesn't yet meet your needs. (Note, that link is to the version 8.1 docs released in late 2013 - so look for the latest version to see what functionality they've added since)
If what you want to do is to manipulate data in R and then send a table of data to Tableau for visualization, you could first try the simple step of exporting the data from R as a CSV file and then visualizing that data in Tableau. I know that's not sexy, but its always good to make sure you've got a way to get the output result you need before investing time in optimizing the process.
If that gets the effect you want, but you just want to automate more of the steps, then take a look at the Tableau Data Extract API. You could use that library to generate a Tableau Data Extract instead of a CSV file. If you have something in production that needs updates, then you could presumably create a python script or JVM program to read your RDS file periodically and generate a revised extract.
Let us assume your data.frame/ tibble etc (say dataset object) is ready in R/ RStudio and you want to connect it with Tableau
1. In RStudio (or R terminal), execute the following steps:
install.packages("Rserve")
library(Rserve)
Rserve() ##This gets the R connection service up and running
2. Now go to Tableau (I am using 10.3.2):
Help > Settings and Performances > Manage External Service Connection
Enter localhost in the Server field and click on Test Connection.
You have now established a connection between R and Tableau.
3. Come back to RStudio. Now we need a .rdatafile that will consist of our R object(s). In this case, dataset. This is the R object that we want to use in Tableau. Enter this in the R console:
save(dataset, file="objectName.rdata")
4. Switch to Tableau now.
Connect To a File > Statistical File
Go to your working directory where the newly created objectName.rdata resides. From the drop down list of file type, select R files (*.rdata, *.rda) and select your object. This will open the object you created in R in Tableau. Alternatively, you can drag and drop your object directly to Tableau's workspace.

Loading Excel into application from client side Excel file

I'm building an application that takes as an input data stored in an Excel sheet. I want the user to be able to select the file they want to load data from, have the application connect to and read from the Excel file stored on the client's machine, and close the connection. Can I do this without uploading the Excel file to the server? I'm able to do everything except for selecting the file using a filedialog box and passing the path & file name to the procedure that connects to the Excel file and processes. I've tried using the file input control but I'm unable to pass the path & file name to the connection string. Any suggestions as to what other routes I might take?
EDIT:
The application essentially takes user input, either via single inputs into textboxes on the page or a bulk upload via an Excel spreadsheet, processes the inputs and spits out a report in Excel format. The only thing displayed on the page are the loaded inputs (via the 2 methods just described) in a listbox that the user can either add or remove additional items.
The short answer is "Only with an ActiveX control in IE unless you write your own plugin for another browser." My opinion is, "you shouldn't."
There is a good discussion already on Stack Overflow: How to read an excel file contents on client side?
The long answer, given the rest of the information you have provided, is that I would recommend the following:
1) Upload the spreadsheet to the server.
2) Extract the data on the server.
3) Return the data to the client in whatever form suits your situation.
4) Clean the original file on the server.
Some further recommendations for you, since you provided so much detail in your comments:
Rather than using a GUID to generate your server-side filename, use a timestamp in the format YYYY-MM-DD-HH-MM-SS-Ticks followed by the original filename.
Instead of deleting the data files immediately, each time you add a file, remove any files older than N days.
This way if you have any issues processing your files in the future, you'll be able to retrieve the uploaded file to your development environment and debug it there. Assuming the data isn't personal information or sensitive in some other way, of course.
Cheers!

generate excel sheet from a excel template in asp.net using vb.net

i need to generate an excel sheet from an excel template which contains drop down lists. I need to use the template and populate the with data from datbase and select the appropriate value from the drop down lists and generate the new excel sheet. I am in very bad situation and need it asap.
try spread Sheet Gear third party component
http://www.spreadsheetgear.com/
OR
http://www.smartxls.com/
You have a few options:
Third-party component ($$$) to read, modify, and send the Excel file.
Office COM automation on the back-end (bad idea. Really. Don't do it).
Save your template on the server as an XML Spreadsheet file (the XML format used by Office 2002 and 2003 and still supported in 2007). Since it's a single XML file, it can be easily read by server-side code, modified on the fly, and redirected back to the user.
Save your template on the server as an XLSX file (the newer XML format used by 2007) and modify it on the way out to the user. Much more complicated since there's a ZIP wrapper and multiple XML files involved.
Save your template on the server as a normal Excel 97/2000 file (not 2007), and when the user requests it, make a copy of the file on the server (requires write access) with a random name, open an database connection using the Excel OLEDB driver to the Excel file, perform INSERT statements into it (goes into tabs of those names, where you store your drop-down values), close the connection, and send the file. Caveat: the Excel OLEDB driver has some limitations.
Go the other direction. Use Excel's web data connection capabilities to access the server after the Excel file is already on the user's machine and open to grab the appropriate values from the server. Requires some user training to refresh the data.

Resources