If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Including Filter values within the csv output

Started by RunningBear, 24 Oct 2024 05:10:12 PM

Previous topic - Next topic

RunningBear

First-Timer with a post . . . I've inherited a report (11.6) that produces a cross-tab report (using 9 filters) from a data package.

The filter values (selected by the user), are displayed in the HTML as well as exported when the user selects 'Excel' as the output.

I need to modify the report to allow for csv output.  The problem is . . . I don't know how to include the filter selections within the csv output file.  Any suggestions will TOTALLY be accepted.

MFGF

Quote from: RunningBear on 24 Oct 2024 05:10:12 PMFirst-Timer with a post . . . I've inherited a report (11.6) that produces a cross-tab report (using 9 filters) from a data package.

The filter values (selected by the user), are displayed in the HTML as well as exported when the user selects 'Excel' as the output.

I need to modify the report to allow for csv output.  The problem is . . . I don't know how to include the filter selections within the csv output file.  Any suggestions will TOTALLY be accepted.

Hi,

Using the csv rendering option is only ever going to give you data - none of the layout from your report will be included. Also, if your report has multiple queries, the csv rendering option will only give you the data from the first query - I remember being caught out by this many (many) years ago. It's the same story with the 'Excel data' rendering option, too. The closest you can get would be to use the 'Excel' rendering option, but this obviously isn't a csv.

Cheers!

MF.
Meep!

RunningBear

Thanks MF.  Followup question . . . I was told that I should try a reporting drop-down with 'Crosstab' or 'list', then when the 'list' is selected, the layout just reflects that and will export out a clean csv file.'

I don't think that is a solution . . . is it?

dougp

I have reports that have conditional outputs.  Graphical-only elements like prompt controls render only in HTML, not in PDF or Excel.  So the Excel output could be a clean dataset with the parameter names and values above or below.

If you absolutely need CSV output, be sure your page contains no header or footer and only a single list (that exactly matches the query) with no summarization.  I haven't seen a way to tell Cognos to include arbitrary text before your CSV output (similar to metadata for the first n lines in an open dataset).  It's a little hokey and will take some creativity, but you may be able to fake your parameter names and values into the output by including them in a different query and UNIONing the two.  So, A UNION B = C, then C is the query for your list.  But then your metadata is between your column headers and the data, so it makes the data difficult to consume. 

Basically, use your imagination... and good luck.  Let us know how you solve this.

adam_mc

There is no way to do this - By definition a .csv output will only have column headers and data included.

That then leaves only "hokey" solutions that dougp indicates.
These include either adding a dummy row of output which could include text like "Filters: A, B, C,..." (this is something along the lines of what dougp is suggesting).
Or, perhaps, adding an additional text column at the end/beginning which would be your filter values in the Column Header Name with all Null values in the data rows.

Just my thoughts.

dougp

I have used R to process open datasets that were in CSV.  Metadata was at the top.  I had to tell R to start reading the file at the line where the data actually begins.  It's a valid format (especially since CSV has a guideline, not a standard).  Maybe Cognos Analytics should be able to read and write CSV files with arbitrary text for an arbitrary number of lines at the beginning of the file.  Consider submitting an RFE.