Page 1 of 1

Clean a carriage return character

Posted: Wed Aug 23, 2017 10:57 am
by zbhmida
hi guys,

i m tring to export data from a cube using ASCIIOutput on a TurboIntegrator process, and on txt export i have a string that contain a carriage return character,

i ve tried to cleansed in the same TI with DELET (pString, SCAN(CHAR(13), pString),1) but it didnt work

do you have any other suggestion

Best regards

Re: Clean a carriage return character

Posted: Wed Aug 23, 2017 11:43 am
by jim wood
As long as you set your field quote character (default ") you should be ok. I guess it depends where the data is going? If it's going back in to TM1 you should be good.

Re: Clean a carriage return character

Posted: Wed Aug 23, 2017 12:15 pm
by zbhmida
Hi Jim,

Yes its going back to TM1,
and Yes the DatasourceASCIIQuoteCharacter='';

i ll try

thank you for your reply
Zied

Re: Clean a carriage return character

Posted: Wed Aug 23, 2017 2:10 pm
by zbhmida
Well,

i have tried:

Code: Select all

nLength = Long(vValeur);
nScan = SCAN(CHAR(13), vValeur);
IF(nScan >0);
vValeur = SubSt(vValeur,1,nScan - 1) | ' ' | SubSt(vValeur,nScan + 1,nLength);
endif;
it works but the string is not loaded totally,
i explain:
LF = CHAR(13) = carriage return caracter,
pString = "tissu S31 'LF'
Partiel des fournitures 7/8" 'CR/LF'
Before i tried new code i had *ERR* on TM1 Cube, and after that i had "Tissu S31" and not all the string,

Any suggestions
Thank you in advance,
Zied

Re: Clean a carriage return character

Posted: Wed Aug 23, 2017 2:19 pm
by jim wood
Well the only thing I can suggest is doing a scan for carriage return ascii character. I can't remember its number but I believe it has one,

Jim.

Re: Clean a carriage return character

Posted: Wed Aug 23, 2017 5:21 pm
by Wim Gielis
Now it will become evident:

Code: Select all

DatasourceASCIIQuoteCharacter = '';

vValeur = 'A ' | Char( 10 ) | ' B ' | Char( 13 ) | ' C ';
AsciiOutput( 'test.txt', vValeur );

# replace CRLF
nLength = Long( vValeur );
nScan = Scan( Char(13), vValeur );
If( nScan > 0 );
vValeur = Subst( vValeur, 1, nScan - 1 ) | ' ' | SubSt( vValeur, nScan + 1, nLength );
EndIf;

AsciiOutput( 'test.txt', '' );
AsciiOutput( 'test.txt', vValeur );

# replace LF
nLength = Long( vValeur );
nScan = Scan( Char(10), vValeur );
If( nScan > 0 );
vValeur = Subst( vValeur, 1, nScan - 1 ) | ' ' | SubSt( vValeur, nScan + 1, nLength );
EndIf;

AsciiOutput( 'test.txt', '' );
AsciiOutput( 'test.txt', vValeur );

Re: Clean a carriage return character

Posted: Thu Aug 24, 2017 9:52 am
by zbhmida
Thank you wim,

it works now ^^

Thk you guys
Best regards

Re: Clean a carriage return character

Posted: Thu Aug 24, 2017 11:00 am
by Wim Gielis
zbhmida wrote: Thu Aug 24, 2017 9:52 am Thank you wim,

it works now ^^

Thk you guys
Best regards
You're welcome 😊