Thanks..but getNames() returns all the segments that should exists in the 
message..not what is currently present in the message.  Calling getNames on an 
ADT message returned the following structures  
MSH,EVN,PID,,PD1NK1,PV1,PV2,DB1,OBX,AL1,DG1,DRG,PR1ROL,GT1,IN1IN2IN3,ACC,UB1,UB2
 and my message only had MSH and PID.

 

 

 

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of VIOT Yves
Sent: Friday, May 09, 2008 5:05 AM
To: clarksonpj
Cc: [email protected]
Subject: Re: [HAPI-devel] How to check if a segmen tis present in a message

 

Hi,
One way, but perhaps not the best (???), could be this:




String[] segNames = hapiMessage.getNames();
 
 
Then jsut browse your string array to find if your seg exists
 
Hope it helps
 
Bye



clarksonpj a écrit : 

Great question, I would also like to know if there is a way of doing this. 
Right now I need to check each element for null.
 
 
 
Lansdale Redmond wrote:
  

        How can I check if a segment is present in a message..when I do the
        following code it always returns a value then if I read a field the vlue
        is null..very similar to if it was there...how do you know the
        difference
         
         
         
        PID seg = (PID) hapiMessage.get("PID");
         
                if ( seg == null)
         
                    return false;
         
                else
         
                return true;
         
         
        
-------------------------------------------------------------------------
        This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
        Don't miss this year's exciting event. There's still time to save $100. 
        Use priority code J8TL2D2. 
        
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
        _______________________________________________
        Hl7api-devel mailing list
        [email protected]
        https://lists.sourceforge.net/lists/listinfo/hl7api-devel
         
         
            

:-)
  

 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to