Page 1 of 1

TI Process Questions

Posted: Thu Jan 15, 2009 5:51 am
by nhavis
A few questions:
--------------------

Within a TI process - how can you find out the names of all cubes?
- Possible solution to look in the Data folder for all files named *.cub ?

Within a TI process - how can you find out the names of all dimensions?
Within a TI process - how can you find out which dimensions a cube is using?
Within a TI process - how can you find out which cubes use a particular dimension?

Re: TI Process Questions

Posted: Thu Jan 15, 2009 6:14 am
by glaurens
nhavis wrote:A few questions:
--------------------

Within a TI process - how can you find out the names of all cubes?
- Possible solution to look in the Data folder for all files named *.cub ?

Within a TI process - how can you find out the names of all dimensions?
Within a TI process - how can you find out which dimensions a cube is using?
Within a TI process - how can you find out which cubes use a particular dimension?

Cubes - loop through }Cubes dimension
Dimns - loop through }Dimensions dimension
Cube/Dimn usage - TABDIM function

G

Re: TI Process Questions

Posted: Thu Jan 15, 2009 11:33 pm
by nhavis
Thanks - how can I get the number of dimensions in a cube?

Re: TI Process Questions

Posted: Thu Jan 15, 2009 11:43 pm
by Alan Kirk
nhavis wrote:Thanks - how can I get the number of dimensions in a cube?
Just loop through the dims until you hit a blank. For example:

Code: Select all

SC_CUBE = 'YourCubeName';

l_Counter = 1;

While ( l_Counter <=256 );

    s_DimName = TabDim ( SC_CUBE, l_Counter); 

    If ( s_DimName @= '');

        l_NumberOfDims = l_Counter - 1;

        l_Counter = 257;

    Else;

        l_Counter = l_Counter + 1;

    EndIf;

End; 

Yes, there probably should be a function to return this, buuuut....

Re: TI Process Questions

Posted: Fri Jan 16, 2009 12:49 am
by ScottW
Documenting_Dimension_Usage_by_Cube.zip
(86.34 KiB) Downloaded 468 times

Re: TI Process Questions

Posted: Fri Jan 16, 2009 1:01 am
by nhavis
Thanks for the quick and concise replies -

How can I add in a a newline character to a string?

Eg.

string = 'Hello';
string = string|'\n';
string = string|'more';

ASCIIOUTPUT('output.txt', string);

How can I add in other special characters?

Re: TI Process Questions

Posted: Fri Jan 16, 2009 1:05 am
by Alan Kirk
nhavis wrote:Thanks for the quick and concise replies -

How can I add in a a newline character to a string?

Eg.

string = 'Hello';
string = string|'\n';
string = string|'more';

ASCIIOUTPUT('output.txt', string);

How can I add in other special characters?
Use the CHAR rules function. New line is Char(10) (though you probably really want carriage return which is Char(13)). You can Google a list of ASCII codes for other characters; there are a lot of charts out there, though I don't have any bookmarked at the moment.

Re: TI Process Questions

Posted: Fri Jan 16, 2009 1:28 am
by nhavis
I see, thanks again -

Is it possible to write an output file without the quotes that ASCIIOUTPUT includes?
Is there any kind of console or substitute?

Re: TI Process Questions

Posted: Fri Jan 16, 2009 1:39 am
by ScottW
ASCIIOutput and TextOutput both write comma delimited files and only output string values encased in quotes, if you want to change this see Gregor's post below ;)

Re: TI Process Questions

Posted: Fri Jan 16, 2009 1:51 am
by nhavis
Thanks -

In regards to inserting new line characters: I tried the following and in notepad it seems not to work:

string = '123';

string = string | Char(10);
string = string | Char(13);

string = string | '456';

ASCIIOUTPUT('output.txt', string);
ExecuteCommand('notepad output.txt', 0);

output.txt contained (when viewed in notepad):
"123456"

however the newline characters were present when viewed in vim/wordpad etc.

Re: TI Process Questions

Posted: Fri Jan 16, 2009 2:51 am
by Alan Kirk
nhavis wrote:Thanks -

In regards to inserting new line characters: I tried the following and in notepad it seems not to work:

string = '123';

string = string | Char(10);
string = string | Char(13);

string = string | '456';

ASCIIOUTPUT('output.txt', string);
ExecuteCommand('notepad output.txt', 0);

output.txt contained (when viewed in notepad):
"123456"

however the newline characters were present when viewed in vim/wordpad etc.
They're there in Notepad too, but the way you've output them they'll just appear as rectangular blocks representing control characters.

The usual sequence when you combine a carriage return and line feed (alias New Line) is CRLF rather than LFCR. Reverse the order so that it's

Code: Select all

string = string | Char(13);
string = string | Char(10);
rather than

Code: Select all

string = string | Char(10);
string = string | Char(13);
I found that that gave the line break that you're after in Notepad.

Re: TI Process Questions

Posted: Fri Jan 16, 2009 3:07 am
by Gregor Koch
Hi

If you want AsciiOutPut without quotes use function
(that's two single quotes no space)

DataSourceASCIIQuoteCharacter='';


If you want no delimiter use function
(can be changed to anything)

DatasourceASCIIDelimiter='';


If you want your output to be eg

123
789

use the above and then

AsciiOutPut('filename', '123');
AsciiOutPut('filename', '789');

Hope it helps

Cheers

Gregor