am trying access data "accountnumber" field in record2 "property". file format flat file (format="fixedlength"). please me on this.
<beanio xmlns="http://www.beanio.org/2012/03"> <stream name="definitions" format="fixedlength"> <record name="header" order="1" minoccurs="1" maxoccurs="1" class="map"> <field name="recordtype" literal="hd" position="0" length="2" rid="true"/> </record> <group name="sample" order="2" minoccurs="0" maxoccurs="unbounded" class="map"> <record name="record1" order="1" minoccurs="1" maxoccurs="1" class="map"> <field name="type" rid="true" literal="pp" position="0" length="2"/> <field name="accountnumber" position="2" length="30"/> </record> <record name="record2" order="2" minoccurs="0" maxoccurs="unbounded" class="map" collection="list" > <field name="type" rid="true" literal="ff" position="0" length="2"/> < ******------ want access "accountnumber" here ------****** /> </record> </group> <record name="trailer" order="3" > <field name="recordtype" rid="true" literal="tt" position="0" length="2"/> </record> </stream> </beanio> sample data:
hd ppxxxxxxxxxxxxxxxxxxxxxxxxxxx ff ff ppyyyyyyyyyyyyyyyyyyyyyyyyyyy ff ff tt
i think have combination after reading records. possible because information record1 exist in map sample group. have iterate on each record2 , set information record1.
i haven't implemented yet, soon, , here strategy using spring-batch:
- i don't group records.
- create different classes 2 records.
- set batch job bean-io
itemreader. - add
classifiercompositeitemprocessorjobsubclassclassifier.- the type map maps 2 records' classes specific
itemprocessors, - the
record1itemprocessoradd information in record step'sexecutioncontext, return null avoiditemwriterbeing called.
- the type map maps 2 records' classes specific
- add
itemwriterjob readexecutioncontext, write combination ofrecord1eachrecord2.
i hope helps.
Comments
Post a Comment