Hi James, You are right. Its working fine with the latest (HAPI 1.0.1) version. I was using 0.6 and 1.0 HAPI libraries where I was not getting the desired result.
Thanks & regards, depeche James Agnew wrote: > > Hi Depeche, > > Which version of the HAPI library are you using? > > The following code executes correctly and produces the output I believe > you > are looking for with the latest (HAPI 1.0.1) version: > > String msgString = > "MSH|^~\\&|XYZ|a1510aae-cbcd-43d0-b0e2-4ad082f03775|HU|7d15ac56-8b12-4a07-8b10-3d2ae367f407|20100831104406||RSP^K23|20100831104406208095|P|2.5\r" > + > "MSA|AA|20100831104406208095\r" + > "QAK||OK\r" + > "QPD|QRY_1001^Query for Corresponding > Identifiers^ICDO|QRY10502106|QBPQ231176^^^57f31a9b-8eff-4736-84c4-6fafd6f25039\r" > + > "PID|||QBPQ231177^^^DD95666A-76BA-444E-8FE8-C4E6BFC83E2D"; > RSP_K23 qryMsg = (RSP_K23) new PipeParser().parse(msgString); > Terser t = new Terser(qryMsg); > > String value = t.get("/.PID-3-1"); > System.out.println("\r\n\r\n" + value); > value = t.get("/QUERY_RESPONSE(0)/.PID-3-1"); > System.out.println(value); > > Cheers, > James > > > On Wed, Sep 1, 2010 at 5:11 AM, depeche007 > <varunkumar.si...@gmail.com>wrote: > >> >> Hi, >> I tried using terserResponse.get("/PID-3-1") and got the >> following >> exception: >> >> Exception: ca.uhn.hl7v2.HL7Exception: Can't find PID as a direct child >> >> regards, >> depeche >> >> >> nksharma0624 wrote: >> > >> > Try changing to terserResponse.get("/PID-3-1") >> > >> > -----Original Message----- >> > From: depeche007 [mailto:varunkumar.si...@gmail.com] >> > Sent: Monday, August 30, 2010 11:27 PM >> > To: hl7api-devel@lists.sourceforge.net >> > Subject: [HAPI-devel] How to get and set values for PID 3 and PID 4 in >> > RSP^K23 HL7 V2.5? >> > >> > >> > Hi, >> > How to get and set values for PID 3 and PID 4 in RSP^K23 HL7 V2.5 >> > response >> > message using terser? >> > >> > Sample response message: >> > >> > >> MSH|^~\&|XYZ|a1510aae-cbcd-43d0-b0e2-4ad082f03775|HU|7d15ac56-8b12-4 >> > >> a07-8b10-3d2ae367f407|20100831104406||RSP^K23|20100831104406208095|P|2.5 >> > MSA|AA|20100831104406208095 >> > QAK||OK >> > QPD|QRY_1001^Query for Corresponding >> > >> Identifiers^ICDO|QRY10502106|QBPQ231176^^^57f31a9b-8eff-4736-84c4-6fafd6 >> > f25039 >> > PID|||QBPQ231177^^^DD95666A-76BA-444E-8FE8-C4E6BFC83E2D >> > >> > >> > Sample code: >> > >> > >> > Parser pResponse = new GenericParser(); >> > Message hapiMsgResponse = pResponse.parse(respMessage); >> > >> > Terser terserResponse = new Terser(hapiMsgResponse); >> > >> > terserResponse.get("/.PID-3-1") >> > terserResponse.get("/QUERY_RESPONSE(0)/.PID-3-1") >> > >> > I get following exception: >> > INFO:Exception: ca.uhn.hl7v2.HL7Exception: End of message reached while >> > iterating without loop >> > >> > >> > regards, >> > depeche >> > >> > -- >> > View this message in context: >> > >> http://old.nabble.com/How-to-get-and-set-values-for-PID-3-and-PID-4-in-R >> > SP%5EK23-HL7-V2.5--tp29579659p29579659.html >> > Sent from the hl7api-devel mailing list archive at Nabble.com. >> > >> > >> > >> ------------------------------------------------------------------------ >> > ------ >> > This SF.net Dev2Dev email is sponsored by: >> > >> > Show off your parallel programming skills. >> > Enter the Intel(R) Threading Challenge 2010. >> > http://p.sf.net/sfu/intel-thread-sfd >> > _______________________________________________ >> > Hl7api-devel mailing list >> > Hl7api-devel@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> > >> > >> ------------------------------------------------------------------------------ >> > This SF.net Dev2Dev email is sponsored by: >> > >> > Show off your parallel programming skills. >> > Enter the Intel(R) Threading Challenge 2010. >> > http://p.sf.net/sfu/intel-thread-sfd >> > _______________________________________________ >> > Hl7api-devel mailing list >> > Hl7api-devel@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> > >> > >> >> -- >> View this message in context: >> http://old.nabble.com/How-to-get-and-set-values-for-PID-3-and-PID-4-in-RSP%5EK23-HL7-V2.5--tp29579659p29591492.html >> Sent from the hl7api-devel mailing list archive at Nabble.com. >> >> >> >> ------------------------------------------------------------------------------ >> This SF.net Dev2Dev email is sponsored by: >> >> Show off your parallel programming skills. >> Enter the Intel(R) Threading Challenge 2010. >> http://p.sf.net/sfu/intel-thread-sfd >> _______________________________________________ >> Hl7api-devel mailing list >> Hl7api-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > Hl7api-devel mailing list > Hl7api-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- View this message in context: http://old.nabble.com/How-to-get-and-set-values-for-PID-3-and-PID-4-in-RSP%5EK23-HL7-V2.5--tp29579659p29603216.html Sent from the hl7api-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Hl7api-devel mailing list Hl7api-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hl7api-devel