Question
· Apr 5, 2021

Complex Mapping with Variable Leading Data

My dilemma is that I'm working with a file that has three different data records plus the header and trailer.  The record type is in positions 21-23.  The header and trailer have spaces in positions 1-20.  The data records have a variable data in positions 1-20.

I tried to use pattern matching in the leading data field however that field is treated as a literal string for matching.

Header Row                             000

Data Row 001       139459911           001

Data Row 002       139459911           002

Data Row 003       139459911           003

Data Row 001       139459044           001

Data Row 002       139459044           002

Data Row 003       139459044           003

Trailer Row                            999

Does anyone have any thoughts?

Product version: HealthShare 2020.2
Discussion (2)1
Log in or sign up to continue

If this record is 

Property Record as %STRING;

you can use 2 calculated properties 

/// true if Header/Trailer
Property HeaderTrailer as %Boolean [Calculated,SqlComputed,
          SqlComputeCode = { set {*} = $extract({Record},1,20)?20" "  }  ];  
/// make integer, 0 for Header / Trailer
Property RecordType as %Integer  [Calculated,SqlComputed,
          SqlComputeCode = { set {*} = $extract({Record},21,23)\1  }  ];