Seems like for now custom code is the only option. I was not able to find any out of the box functionality for writing the counts of the total transactions without a custom code.
Here are few strategies for custom code i looked into.
1) In the File Operation , write the messages to a "Temp" File. At a certain time through a task or some other logic read from the temp file and collect all details you need and then write to another File.
2) I yet have to explore this option. At a point in time when you want your file, read from the Enslib.Hl7.Msg and create a file per your needs.
3) Write the live messages to a temp database. Generate necessary file from it when needed. Delete the messages from the DB and copy it to a Archive DB if needed.
4) As live messages are coming write to a Global and then run a task to create messages from the Globals.
I earlier tried the approach using the Record Mapper but it did not seam feasible in this scenario.
So i have done is
Created a CUSTOM operation class which extends Ens.BusinessOperation, EnsLib.HL7.Operation.Standard
It uses the file adapter.
Then I overided the oninit and outputDocument method.
The file adapter creates HL7 file as usual
I created a new method which calls the override outputDocument method and passes the filename . Then I do a count of segments and create another file into which I copy all the necessary information and delete the file which was originaly created .
Above method is called in oninit, so it is triggered on schedule whenever the operation starts. First I check if a file exists, if it does and is not the current file then I call this new method.
That is very helpful. I wasnt aware of this class method or class. Thank you for your assistance. I will use it and let you know if i encounter any issue.
I also tried using another method where i read the stream object using ReadLine.
Then if the string starts with "MSH" OR "FT1" i increment the count.
In that case i have to use the Terminator character as $C(10) or $C(13)
go to post
Hello Pankaja,
Seems like for now custom code is the only option. I was not able to find any out of the box functionality for writing the counts of the total transactions without a custom code.
Here are few strategies for custom code i looked into.
1) In the File Operation , write the messages to a "Temp" File. At a certain time through a task or some other logic read from the temp file and collect all details you need and then write to another File.
2) I yet have to explore this option. At a point in time when you want your file, read from the Enslib.Hl7.Msg and create a file per your needs.
3) Write the live messages to a temp database. Generate necessary file from it when needed. Delete the messages from the DB and copy it to a Archive DB if needed.
4) As live messages are coming write to a Global and then run a task to create messages from the Globals.
Thanks,
Jimmy Christian.
go to post
Thank you Marc for the detailed information.
I earlier tried the approach using the Record Mapper but it did not seam feasible in this scenario.
So i have done is
Created a CUSTOM operation class which extends Ens.BusinessOperation, EnsLib.HL7.Operation.Standard
It uses the file adapter.
Then I overided the oninit and outputDocument method.
go to post
Ha ha. Thanks Jeffrey.
Yes the class name User.HL7.Stream seemed like the system defined class.
go to post
That is very helpful. I wasnt aware of this class method or class. Thank you for your assistance. I will use it and let you know if i encounter any issue.
I also tried using another method where i read the stream object using ReadLine.
Then if the string starts with "MSH" OR "FT1" i increment the count.
In that case i have to use the Terminator character as $C(10) or $C(13)
Regards,
Jimmy Christian.
go to post
We are not sending telephone number.
go to post
Thanks Neerav. That is correct.
go to post
Thank you Jenna.
You are absolutely right. I was able to update the DTL code and send a EnsStreamContainer object to the Operation.
It worked perfectly.
Regards,
Jimmy Christian.
go to post
Thank you Jeffrey. This is very helpful.
I didnt realize we can use Source property in the Condition.
go to post
Yep !
I did restart the Operation after putting the logic. I had forgotten to set the return status to an error code.
I think E=D works when the %Status has an error code.
Thank you for help.
Regards,
Jimmy Christian.
go to post
Thank you Eduard.
Exactly !
I forgot to set the return status to an error in Catch Block.
I set to an error code and the Operation is down.
Thank you for help.