ASCII problem !!

Post Reply
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

ASCII problem !!

Post by beber005 »

Hi everyone,
I have a little problem, I don't know how to use code ASCII. I want to specify in this formula (for example)

Code: Select all

ASCIIOutput (cOutputLog 'Error copying process');
a newline. Let me explain: This final variable is a body of an email and I return regularly to the line. However, I do not know how to do that thank's to TM1. In other language, you just need to specify "\ n" in the string to do this but there ...
Thank you very much for your help :D
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: ASCII problem !!

Post by Alan Kirk »

beber005 wrote:Hi everyone,
I have a little problem, I don't know how to use code ASCII. I want to specify in this formula (for example)

Code: Select all

ASCIIOutput (cOutputLog 'Error copying process');
a newline. Let me explain: This final variable is a body of an email and I return regularly to the line. However, I do not know how to do that thank's to TM1. In other language, you just need to specify "\ n" in the string to do this but there ...
Thank you very much for your help :D
That's not a formula. And I'm not being pedantic when I say that, I mean that it's not intended to calculate anything. All it does is to output the text that you specify in the second (and following, if applicable) arguments into the file that you specify in the first argument.

There is no need to append a new line to the output string; every time you write a string to an ASCII file it goes onto a new line anyway.

If you want to insert a blank line below your output, you could use the Code() rules functions to append the relevant ASCII characters to the string (typically CR and LF) or, perhaps even more simply, just add an extra ASCIIOutput command which inserts a blank line below your existing one:

Code: Select all

ASCIIOutput (cOutputLog, 'Error copying process');
ASCIIOutput (cOutputLog, '');
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Wim Gielis
MVP
Posts: 3230
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: ASCII problem !!

Post by Wim Gielis »

And also, do not forget the comma after the filename for the asciioutput.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

Re: ASCII problem !!

Post by beber005 »

Yes I know Kirk, you play with words ^ ^
No, I can not write another ASCIIOutput. My return line must be in the same ASCIIOutput because it is sent or rather used by the SMTP service. In short there is not the problem, ultimately what I wanted to know was if it was possible to have an equivalent of "\ n"
So yes I used the CODE () function and I know the ASCII code '' but I do not know then use :oops:
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: ASCII problem !!

Post by Alan Kirk »

beber005 wrote:Yes I know Kirk, you play with words ^ ^
No, I can not write another ASCIIOutput. My return line must be in the same ASCIIOutput because it is sent or rather used by the SMTP service. In short there is not the problem, ultimately what I wanted to know was if it was possible to have an equivalent of "\ n"
So yes I used the CODE () function and I know the ASCII code '' but I do not know then use :oops:
"I am not playing. This is not a a game..."[1]

I do however sometimes mistype; I said Code but meant Char. (Code goes in the opposite direction.)

The ASCII equivalent to \n is the newline character, or Char(10). Thus:

Code: Select all

# Assuming that you don't want the content surrounded in quotes, as seems likely:
DatasourceASCIIQuoteCharacter='';

s_OutputString = 'Error copying process' | Char(10);

ASCIIOutput (cOutputLog, s_OutputString );
However I'm still not at all clear on what you mean to do with this since the only thing that ASCIIOutput does is generate a text file, and in that respect it doesn't matter whether it does it in one step or two.

--------------------
[1] Obscure quotation from the same source as my current signature.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

Re: ASCII problem !!

Post by beber005 »

Ok alan I didn't remember the function "CHAR()" sorry. But yes with it's working. What I do it's not easier to explain :oops:
Post Reply