Question
Carl Emberger · 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
00
2 0 2 54
Log in or sign up to continue

Replies

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  }  ];  


 

It seems to me this would be a good task for the Complex Record Mapper.

See docs and video.

Note for just a Header and Trailer even the "Simple" Record Mapper could be enough and you wouldn't need the "Complex" one, by using the "Batch" feature, see docs here.