Recent posts:
Stephen has not published any posts yet.
Recent replies:

Here is a custom function that you may call from rules or transformations that will return the age in your choice of years, months, days.

Note that this is a complete export.

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2017.2.1 (Build 801U)" ts="2020-03-16 16:31:49">
<Class name="Custom.GetAge">
<Description>
Calculates and returns the age from the birthday passed in %Y%m%d format comparing to current date or passed in date.
ReturnUnits is "Y" (Default) for Years, "m" for Months, or "d" for Days
currentday in HL7 format, defaults to today if blank  </Description>
<ProcedureBlock>1</ProcedureBlock>
<Super>Ens.Rule.FunctionSet</Super>
<TimeChanged>65454,59370.735262</TimeChanged>
<TimeCreated>62585,49624.168815</TimeCreated>

<UDLText name="T">
<Content><![CDATA[
// ClassMethod GetAge(birthday As %String, ReturnUnits As %String, currentday As %String) As %String [ Final ]

]]></Content>
</UDLText>

<Method name="GetAge">
<Description>
returns the current age in years with birtday passed in %Y%m%d format</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec>birthday:%String,ReturnUnits:%String="Y",currentday:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

    // convert date times into correct format
    set Tbirthformat = ##class(Ens.Util.Time).ConvertDateTime(birthday,"%Y%m%d","%q(3)" )
    if currentday '= ""
    {
       set Tcurrentformat = ##class(Ens.Util.Time).ConvertDateTime(currentday,"%Y%m%d","%q(3)")
    }
    else
    {   set Tcurrentformat = $h
    }
    
    set bmonth = $SYSTEM.SQL.DATEPART("mm",Tbirthformat)       
    set cmonth = $system.SQL.DATEPART("mm",Tcurrentformat)
    set bday = $system.SQL.DATEPART("dd",Tbirthformat)
    set cday = $system.SQL.DATEPART("dd",Tcurrentformat)
    set tretval = 0
    if (ReturnUnits = "Y") || (ReturnUnits = "y") || (ReturnUnits = "")
    {
      // calculate the difference in years by subtracting the birthday from the currentday
      set difftimeYear = $SYSTEM.SQL.DATEDIFF("yy",Tbirthformat,Tcurrentformat) // get the years

      if bmonth = cmonth   //check day since the month is the same
      {  
         if cday < bday
         {
           set difftimeYear = difftimeYear - 1
         }
      }
      else
      {  if cmonth < bmonth
         {
           set difftimeYear = difftimeYear - 1
         }
      }
      // return the age in years
      set tretval = difftimeYear
    }
    else
    { if (ReturnUnits = "M") || (ReturnUnits = "m")
      {
          set difftimeMonth = $SYSTEM.SQL.DATEDIFF("mm",Tbirthformat,Tcurrentformat)  // get the months
          if bmonth = cmonth
          { if cday < bday
            {  set difftimeMonth = difftimeMonth - 1
            }
          }
           // return the age in months
           set tretval = difftimeMonth
      }
      else
      {  if (ReturnUnits = "D") || (ReturnUnits = "d")
         { set difftimeDay = $SYSTEM.SQL.DATEDIFF("dd",Tbirthformat,Tcurrentformat)  // get the days
           // return the age in days
           set tretval = difftimeDay
         }
      }
    }
    quit tretval
]]></Implementation>
</Method>
</Class>
</Export>

How are you bringing the messages in?   I assume through an HL7 service.    The MessageSchemaCategory must be set correctly in the service and the DocType will get set correctly.

If parsed correctly according to the schema then the message will show as Blue in the contents tab of the the message viewer,  if any segments do not match the schema then the message will show as Black at the point of mismatch.   You need to get the message to show as all Blue or the paths (word or numerical) cannot be followed.

Your screenshots showed using the testing facility for the rules and you are using "User Input".   If you scroll down in the form you will find a field to enter the DocType manually.   This field needs to have the syntax I showed above with the schemaname:ORU_R01 in your case.

The DocType is not set in the message header.  

It should look more like the following:  Note that the example below is a custom schema ORUPDF.

Without this set the word paths cannot be used to retrieve the values because these depend on referencing the schema named in the DocType.  

This DocType is assigned within the service normally.

I believe you could also change all the paths to be numerical and it may work:  such as MSH:9.2

Followers:
Stephen has no followers yet.
Following:
Stephen has not followed anybody yet.
Global Masters badges:
Stephen has no Global Masters badges yet.