Eport as XML

Post Reply
Venkat1688
Posts: 5
Joined: Tue Sep 13, 2011 7:49 am
OLAP Product: Oracle 10 g
Version: 9.5.1
Excel Version: 2007

Eport as XML

Post by Venkat1688 »

Hi all,

Is it possible in TM1 to export data in XML format like we export as CSV ??
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Eport as XML

Post by tomok »

No, not natively. You would have to write your own code in TI to create the XML tags and use them in the TextOutput function.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Venkat1688
Posts: 5
Joined: Tue Sep 13, 2011 7:49 am
OLAP Product: Oracle 10 g
Version: 9.5.1
Excel Version: 2007

Re: Eport as XML

Post by Venkat1688 »

Thanks tomok.
Can i get a sample code or link where i can learn about it in detail. That would be great.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Eport as XML

Post by tomok »

Venkat1688 wrote:Thanks tomok.
Can i get a sample code or link where i can learn about it in detail. That would be great.
There isn't any that I know of. That's why I said you would have to write your own.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Eport as XML

Post by rmackenzie »

Code: Select all

# set empty string as quote char
DatasourceASCIIQuoteCharacter = '';

# set filename
sFileName = 'test.xml';

# header
sXml = '<?xml version="1.0" encoding="UTF-8"?>';
AsciiOutput ( sFileName, sXml );

# open root 
sXml = '<root>';
AsciiOutput ( sFileName, sXml );

# open branch
sXml = '<branch>';
AsciiOutput ( sFileName, sXml );

# populate some leaf information
nCounter = 1;
nMaxLeaves = 10;
WHILE ( nCounter <= nMaxLeaves );

  # open leaf
  sXml = '<leaf';
  sXml = sXml | ' name="' | NumberToString ( nCounter ) | '"';
  sXml = sXml | ' type="example">';

  # close leaf
  sXml = sXml | '</leaf>';

  # output
  AsciiOutput ( sFileName, sXml );
  nCounter = nCounter + 1;

END;

# close branch
sXml = '</branch>';
AsciiOutput ( sFileName, sXml );

# close root 
sXml = '</root>';
AsciiOutput ( sFileName, sXml );
Robin Mackenzie
iansdigby
Community Contributor
Posts: 109
Joined: Thu Feb 26, 2009 8:44 am
OLAP Product: TM1
Version: 9 + 10 + Plan An
Excel Version: All
Location: Isle of Wight, UK

Re: Eport as XML

Post by iansdigby »

Blessings upon rmackenzie for one of the most time-saving and useful snippets of code hertofore posted herein.

rmackenzie wrote:

Code: Select all

# set empty string as quote char
DatasourceASCIIQuoteCharacter = '';

# set filename
sFileName = 'test.xml';

# header
sXml = '<?xml version="1.0" encoding="UTF-8"?>';
AsciiOutput ( sFileName, sXml );

# open root 
sXml = '<root>';
AsciiOutput ( sFileName, sXml );

# open branch
sXml = '<branch>';
AsciiOutput ( sFileName, sXml );

# populate some leaf information
nCounter = 1;
nMaxLeaves = 10;
WHILE ( nCounter <= nMaxLeaves );

  # open leaf
  sXml = '<leaf';
  sXml = sXml | ' name="' | NumberToString ( nCounter ) | '"';
  sXml = sXml | ' type="example">';

  # close leaf
  sXml = sXml | '</leaf>';

  # output
  AsciiOutput ( sFileName, sXml );
  nCounter = nCounter + 1;

END;

# close branch
sXml = '</branch>';
AsciiOutput ( sFileName, sXml );

# close root 
sXml = '</root>';
AsciiOutput ( sFileName, sXml );
"the earth is but one country, and mankind its citizens" - Baha'u'llah
Post Reply