Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add csv or xml data source

Status
Not open for further replies.

flashbbeb

MIS
Mar 29, 2005
106
US
Hi all,

I'm very new to Cognos, and in training only covered ODBC connections. I have a flat file I need to use as a data source that comes to me as a pipe-delimited text file, which I usually convert (text to cols) to XLS to work with in Excel. The data itself is just a table with the first row as headers (i.e. employeeID,fname,lname,etc).

Does anyone know how to use a flat file (txt or csv) as a data source?

When I convert the XLS to XML and try to connect to it I receive errors that with my novice XML understanding indicate that saving directly to XML in Excel won't conform to Cognos' XML schema xmldata.xsd (pasted below).

How do I structure my XML file? All data are strings, and each header element is a simple, non-nested element - employeeID, fname, lname, etc.

Thanks! EB

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
    Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
-->
<xs:schema xmlns:d="[URL unfurl="true"]http://developer.cognos.com/schemas/xmldata/1/"[/URL] xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] targetNamespace="[URL unfurl="true"]http://developer.cognos.com/schemas/xmldata/1/"[/URL] elementFormDefault="qualified">
	<xs:element name="dataset">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="metadata" type="d:metadataType"/>
				<xs:element name="data" type="d:dataType"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="metadataType">
		<xs:sequence>
			<xs:element name="item" type="d:itemType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="itemType">
		<xs:attribute name="name" type="xs:token" use="required"/>
		<xs:attribute name="type" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:NMTOKEN">
					<xs:enumeration value="xs:ENTITIES"/>
					<xs:enumeration value="xs:ENTITY"/>
					<xs:enumeration value="xs:ID"/>
					<xs:enumeration value="xs:IDREF"/>
					<xs:enumeration value="xs:IDREFS"/>
					<xs:enumeration value="xs:NCName"/>
					<xs:enumeration value="xs:NMTOKEN"/>
					<xs:enumeration value="xs:NMTOKENS"/>
					<xs:enumeration value="xs:NOTATION"/>
					<xs:enumeration value="xs:Name"/>
					<xs:enumeration value="xs:QName"/>
					<xs:enumeration value="xs:anyURI"/>
					<xs:enumeration value="xs:base64Binary"/>
					<xs:enumeration value="xs:boolean"/>
					<xs:enumeration value="xs:byte"/>
					<xs:enumeration value="xs:date"/>
					<xs:enumeration value="xs:dateTime"/>
					<xs:enumeration value="xs:decimal"/>
					<xs:enumeration value="xs:double"/>
					<xs:enumeration value="xs:duration"/>
					<xs:enumeration value="xs:float"/>
					<xs:enumeration value="xs:gDay"/>
					<xs:enumeration value="xs:gMonth"/>
					<xs:enumeration value="xs:gMonthDay"/>
					<xs:enumeration value="xs:gYear"/>
					<xs:enumeration value="xs:gYearMonth"/>
					<xs:enumeration value="xs:hexBinary"/>
					<xs:enumeration value="xs:int"/>
					<xs:enumeration value="xs:integer"/>
					<xs:enumeration value="xs:language"/>
					<xs:enumeration value="xs:long"/>
					<xs:enumeration value="xs:negativeInteger"/>
					<xs:enumeration value="xs:nonNegativeInteger"/>
					<xs:enumeration value="xs:nonPositiveInteger"/>
					<xs:enumeration value="xs:normalizedString"/>
					<xs:enumeration value="xs:positiveInteger"/>
					<xs:enumeration value="xs:short"/>
					<xs:enumeration value="xs:string"/>
					<xs:enumeration value="xs:time"/>
					<xs:enumeration value="xs:token"/>
					<xs:enumeration value="xs:unsignedByte"/>
					<xs:enumeration value="xs:unsignedInt"/>
					<xs:enumeration value="xs:unsignedLong"/>
					<xs:enumeration value="xs:unsignedShort"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="length" type="xs:int" use="optional"/>
		<xs:attribute name="scale" type="xs:int" use="optional"/>
		<xs:attribute name="precision" type="xs:int" use="optional"/>
		<!--precision is usually tied to decimal type (xs:decimal), but it is also used specify the interval qualifier for interval type (xs:duration).  In this case the following values represent different interval qualifier: 0 for unknown, 1 for second, 2 for minute, 3 for minute to second, 4 for hour, 6 for hour to minute, 7 for hour to second, 8 for day, 12 for day to hour, 14 for day to minute, 15 for day to second, 16 for month, 32 for year, 48 for year to month.-->
	</xs:complexType>
	<xs:complexType name="dataType">
		<xs:sequence>
			<xs:element ref="d:row" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="row">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="value" nillable="true" maxOccurs="unbounded">
					<xs:complexType mixed="true">
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute name="currency"/>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
 
What Cognos application? I use flat files as sources in Transformer and Impromptu (best in the former, as lack of indices are a real performance issue in the latter).

soi là, soi carré
 
I'm trying to connect the file to Cognos Framework Manager - I've never used (and don't have access to) Transformer or similar software to create cubes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top