should replace <CR> by <blank> and remove <lf>
CCL>set x=$c(13,10,10,13)
CCL>set y= $tr(x,$c(13,10)," ")
CCL>w $l(y)
2
CCL>w $a($e(y,1))
32
CCL>w $a($e(y,2))
32
Try:
CL>set x=$c(13,10,10,13)
CL>set y= $replace(x,$c(13,10)," ")
CL>w $l(y)
3
CL>w $a($e(y,1))
32
CL>w $a($e(y,2))
10
CL>w $a($e(y,3))
13
HTH
André
On Jan 6, 4:44 am, Andre Cerri <andre.ce...@intersystems.com> wrote:
Nope, that will replace $c(13) with space and $c(10) with null.
??? so what's your message ???
the additionl removal of <lf> = $c(10) ?
This simple $TRanslate() function does it:
CCL>Set original=$C(13,10,10,13)
CCL>Set cleaned = $TR(original,$C(13,10)," ")
CCL>w $L(cleaned)
2
CCL>w $A($E(cleaned,1))
32
CCL>w $a($E(cleaned,2))
32
Ted
----- Original Message -----
From: "htg" <herman...@googlemail.com>
To: "InterSystems: Ensemble in Healthcare"
<Ensemble-in...@googlegroups.com>
Sent: Wednesday, January 06, 2010 5:33 AM
Subject: [InterSystems-EnsHlth] Re: Remove Carriage Returns
--------------------------------------------------------------------------------
> --
> You received this message because you are subscribed to the Google Groups
> "InterSystems: Ensemble in Healthcare Community" group.
> To post to this group, send email to
> Ensemble-in...@googlegroups.com
> To unsubscribe from this group, send email to
> Ensemble-in-Healt...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
She didn't say anything about linefeeds.
$TR(original,$C(13)," ")
i have a problem for you.
I want to Remove Carriage Returns into streams (for example the below
stream is taken by EnsLib.File.InboundAdapter)
H|~^\&|8040200007||1~DXLAB||ORU|||2~SRA||P|H2.1|200804021123|
P|1|110050131|141289|89000056|POISSON~PANE~~~MLLE~||19870214|
F|||||||||||||||20080326~20080326||
OBR|7|080400007|~51179|RCTH~Ren.cliniques axe thyroidien~L|S||
200804021151||||N|||200804021151||~~~9035||||||||~LABORATOIRE Central|
F|
OBX|1|ST|RCTH~Ren.cliniques axe thyroidien(Renseignements cliniques)
~L||petit commentaire pour tester que tout passe...||||||F||||
HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~1|OLWATT
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème|||
A||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~2|OLWATT
L|1||1|6
I have created a BS with in Method OnProcessInput(pInput As
%RegisteredObject,pOutput As %RegisteredObject) :
set pTargetStream=##class(%FileCharacterStream).%New()
// Suppression des retours chariots (à tester)
set identifier=$C(13)
set associator=""
set tSC=##class(DemoSante.Util.EnsUtils).Translate(pInput,
pTargetStream, identifier, associator)
set tSC=pTargetStream.%Save()
with
ClassMethod Translate(
sourceStream As %FileCharacterStream,
targetStream As %FileCharacterStream,
identifier As %String,
associator As %String = "") As %Status
{
while 'sourceStream.AtEnd {
set sourceLine=sourceStream.ReadLine()
set targetLine=$TRANSLATE(sourceLine,identifier,associator)
set tSC=targetStream.WriteLine(targetLine)
}
quit tSC
}
and the result is
H|~^\&|8040200007||1~DXLAB||ORU|||2~SRA||P|H2.1|200804021123|
P|1|110050131|141289|89000056|POISSON~PANE~~~MLLE~||19870214|
F|||||||||||||||20080326~20080326||
OBR|7|080400007|~51179|RCTH~Ren.cliniques axe thyroidien~L|S||
200804021151||||N|||200804021151||~~~9035||||||||~LABORATOIRE Central|
F|
OBX|1|ST|RCTH~Ren.cliniques axe thyroidien(Renseignements cliniques)
~L||petit commentaire pour tester que tout passe...||||||F||||
HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~1|OLWATT
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème|||||||
L|1||1|6
the carriage return has been replaced by "" but the others caracters
have not be taken into account.
Have you a solution ?
Thank you
Regards
Eric Sebelin
On 6 jan, 22:07, Neerav Verma <vnee...@gmail.com> wrote:
> No Worries
>
> Thank You,
>
> Neerav Vermahttp://www.linkedin.com/in/vneerav
> ------------------------------------------------------
> Stephen Leacock<http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html>
> - "I detest life-insurance agents: they always argue that I shall some
> day
> die, which is not so."
>
> On Wed, Jan 6, 2010 at 3:21 PM, Andre Cerri <andre.ce...@intersystems.com>wrote:
>
>
>
> > Oh, sorry Neerav, I thought I saw someone refer to you as 'she' in a
> > previous post. Apologies.
>
> > ------------------------------
> > *From:* ensemble-in...@googlegroups.com [mailto:
> > ensemble-in...@googlegroups.com] *On Behalf Of *Neerav Verma
> > *Sent:* Wednesday, January 06, 2010 3:00 PM
>
> > *To:* ensemble-in...@googlegroups.com
> > *Subject:* Re: [InterSystems-EnsHlth] Re: Remove Carriage Returns
>
> > In case you were referring to me. I am He not She ;)
>
> > Thank You,
>
> > Neerav Verma
> >http://www.linkedin.com/in/vneerav
> > ------------------------------------------------------
> > Charles de Gaulle<http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html> - "The better I get to know men, the more I find myself loving dogs."
> >> On Tue, Jan 5, 2010 at 7:04 PM, Neerav Verma <vnee...@gmail.com>
> >> wrote:
> >> What would be the command to replace carriage returns with space
>
> >> On Jan 6, 4:44 am, Andre Cerri <andre.ce...@intersystems.com> wrote:
> >> Nope, that will replace $c(13) with space and $c(10) with null.
>
> >> ??? so what's your message ???
> >> the additionl removal of <lf> = $c(10) ?
>
> >> --------------------------------------------------------------------------------
> >http://groups.google.com/group/Ensemble-in-Healthcare?hl=en- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
Hi everybody,
set pTargetStream=##class(%FileCharacterStream).%New()
and the result is
Thank you
Regards
Eric Sebelin
--------------------------------------------------------------------------------
set sourceLine=pInput.Read()
set pTa=$TRANSLATE(sourceLine,$C(13)," ")
set tSC=pTargetStream.WriteLine(pTa)
set tSC=pTargetStream.%Save()
and the result is : the carriage return is remplaced by " " but after
this carriage return until end of this line, i have no character :
for example :
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème|||
A||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~2|
OLWATT
the carriage return is after A character third line and the result
obtained :
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème||| ||||||||
I want :
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème||| ||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE
THYROIDIEN~4~RCTH~1~2|OLWATT
Have you an idea ?
Regards
Eric Sebelin
> > >http://groups.google.com/group/Ensemble-in-Healthcare?hl=en-Masquer le
> > >texte des messages précédents -
>
> > - Afficher le texte des messages précédents -
>
> --------------------------------------------------------------------------------
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "InterSystems: Ensemble in Healthcare Community" group.
> > To post to this group, send email to
> > Ensemble-in...@googlegroups.com
> > To unsubscribe from this group, send email to
> > Ensemble-in-Healt...@googlegroups.com
> > For more options, visit this group at
I am not sure if Google translated out any special characters, but it
may be easier if you indicate any special characters in your incoming
data, and what you want the output to look like. Something like:
Incoming data:
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néothyroïdien
?)~L||cher docteur, cette ligne de commentaire sert àtester le retour
charriot~si ca passe c'est que le retour charriotn'est plus un
problème|||[CarriageReturn][NewLine]
A||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~2|OLWATT
etc.
I suspect part of the problem may be due to the fact that you are using
WriteLine() for output - the exact behaviour in this case will depend on
the terminators defined for your target stream.
Hopefully we can get to the bottom of this one.
Dale
I test these commands:
set sourceLine=pInput.Read()
set pTa=$TRANSLATE(sourceLine,$C(13)," ")
set tSC=pTargetStream.Write(pTa)
set tSC=pTargetStream.%Save()
with incoming data :
...
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur, cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème|||[CarriageReturn][NewLine]
A||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE THYROIDIEN~4~RCTH~1~2|OLWATT
[CarriageReturn][NewLine]
...
and i obtain :
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur. cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème||| ||||||||[CarriageReturn][NewLine]
i want to obtain :
OBX|2|ST|RCTHK~Ren.cliniques axe thyroidien(Présence d'un néo
thyroïdien ?)~L||cher docteur. cette ligne de commentaire sert à
tester le retour charriot~si ca passe c'est que le retour charriot
n'est plus un problème|||A||||F||||HORMONOLOGIE~10~ETUDE DE L' AXE
THYROIDIEN~4~RCTH~1~2|OLWATT[CarriageReturn][NewLine]
Have you a solution ?
Regards,
Eric Sebelin
> ...
>
> plus de détails »- Masquer le texte des messages précédents -
to verify the content of pTa use ZZDUMP pTa if in Terminal mode.
if not:
Open 1 use 1 ZZDUMP pTa Close 1
and see the result in cconsole.log
if you dislike spamming cconsole.log:
set file="c:\temp\mydump.txt" or equivalent in unix
Open file:("WNS") use file ZZDUMP pTa close file
i remove all carriage returns as :
H|~^\&|8040200007||1~DXLAB||OR[CarriageReturn]
U|||2~SRA||P|H2.1|200804021123|[CarriageReturn][NewLine]
P|1|110071393|188728|107040448|COSBANN~FRANCOISE~~~MLLE~||19450628|
F|||||||||||||||20071211~20071211||[CarriageReturn][NewLine]
becomes
H|~^\&|8040200007||1~DXLAB||ORU|||2~SRA||P|H2.1|200804021123|[NewLine]
P|1|110071393|188728|107040448|COSBANN~FRANCOISE~~~MLLE~||19450628|
F|||||||||||||||20071211~20071211||[NewLine]
but how to do for adding [CarriageReturn] ?
H|~^\&|8040200007||1~DXLAB||ORU|||2~SRA||P|H2.1|200804021123|
[CarriageReturn][NewLine]P|1|110071393|188728|107040448|
COSBANN~FRANCOISE~~~MLLE~||19450628|F|||||||||||||||20071211~20071211||
[CarriageReturn][NewLine]
Regards
I can now see that the problem you have is extra <CR> characters, not
extra <CR,LF> pairs.
Why don't you try this instead?
set sourceLine = pInput.Read()
set pTa = $TRANSLATE(sourceLine,$C(13),"")
set pTa = $Replace(pTa, $C(10),$C(13,10))
//$$$LOGINFO("pTa "_pTa)
//Open 1 use 1 ZZDUMP pTa Close 1
set tSC = pTargetStream.Write(pTa)
set tSC = pTargetStream.%Save()
This should remove all $c(13) characters, and then convert all remaining
$c(10) characters to $c(13,10).
I hope that's what you are trying to do,
Dale
With
set sourceLine = pInput.Read()
set pTa = $TRANSLATE(sourceLine,$C(13),"")
set pTa = $Replace(pTa, $C(10),$C(13,10))
$$$LOGINFO("pTa "_pTa)
//Open 1 use 1 ZZDUMP pTa Close 1
set tSC = pTargetStream.Write(pTa)
set tSC = pTargetStream.%Save()
the pTa is
pTa H|~^\&|8040200007||1~DXLAB||OR U|||2~SRA||P|H2.1|200804021123|
[CarriageReturn?][NewLine?] P|1|110071393|188728|107040448|
COSBANN~FRANCOISE~~~MLLE~||19450628|F|||||||||||||||
20071211~20071211||
but after i want t read all first line and all twice line to parse
them for example
while 'pTargetStream.AtEnd {
set tSubject=pTargetStream.ReadLine()
//set tSubject=pTargetStream.Read()
$$$LOGINFO("tSubject "_tSubject)
set typeSeg=$Piece(tSubject,"|",1)
}
and in this case i have
tSubject P|1|110071393|188728|107040448|COSBANN~FRANCOISE~~~MLLE~||
19450628|F|||||||||||||||20071211~20071211||
tSubject U|||2~SRA||P|H2.1|200804021123|
tSubject H|~^\&|8040200007||1~DXLAB||OR
i wanted
tSubject P|1|110071393|188728|107040448|COSBANN~FRANCOISE~~~MLLE~||
19450628|F|||||||||||||||20071211~20071211||
tSubject H|~^\&|8040200007||1~DXLAB||ORU|||2~SRA||P|H2.1|200804021123|
> > set tSC = pTargetStream.%Save()- Masquer le texte des messages précédents -
Eric, do you think you could open a WRC case and ask our support advisers to
help you construct it exactly the way you want?
I think that would probably be faster and more effective than continuing
this email exchange.
Best regards,
Ted
----- Original Message -----
From: "eric" <eric.s...@alyotech.fr>
To: "InterSystems: Ensemble in Healthcare"
<Ensemble-in...@googlegroups.com>
Sent: Thursday, January 14, 2010 11:15 AM
Subject: [InterSystems-EnsHlth] Re: Remove Carriage Returns
Hi Dale,
With
--------------------------------------------------------------------------------