Closed
Description
May rather be a question than a real issue.
I have a MSCONS D04B Message (some files with multiple UNH-Messages, if relevant).
I want to process the SG10 QTY segments.
So I tried
$this->ediParser->load($ediFile);
$ediData = $this->ediParser->get();
$this->ediReader->setParsedFile($ediData);
$this->mappingProvider = new \EDI\Mapping\MappingProvider($ediMessageVersion);
$segments = $this->ediAnalyser->loadSegmentsXml($this->mappingProvider->getSegments());
$serviceSegments = $this->ediAnalyser->loadSegmentsXml($this->mappingProvider->getServiceSegments(3));
$this->ediInterpreter = new \EDI\Interpreter($this->mappingProvider->getMessage($ediMessageType), $segments, $serviceSegments);
$preparedInterpreter = $this->ediInterpreter->prepare($ediData);
http://www.stylusstudio.com/edifact/d04b/MSCONS.htm#part4.3.1
This way I get a nice array in $preparedInterpreter, where I can navigate to SG9. There I would expect to find the QTY Segments.
But there is only one, whereas the file contains 960.
SG9 => array(1 item) 0 => array(4 items) lineItem => array(3 items) additionalProductId => array(4 items) quantity => array(3 items) segmentIdx => 13 (integer) segmentCode => 'QTY' (3 chars) quantityDetails => array(2 items) quantityTypeCodeQualifier => '220' (3 chars) quantity => '3.484' (5 chars) date/time/period => array(2 items) 0 => array(3 items) segmentIdx => 14 (integer) segmentCode => 'DTM' (3 chars) date => array(3 items) 1 => array(3 items) segmentIdx => 15 (integer) segmentCode => 'DTM' (3 chars) date => array(3 items)
What am I missing/doing wrong?
Otherwise I could loop like this:
foreach($this->ediInterpreter->getMessages() as $message) {
foreach($message as $segmentIndex => $segment) {
if($segmentName == 'XXX') {
// do some stuff
}
}
}
But I am unsure if this is the intended way with this library. In the Examples I could not find anything suitable.
Thanks for your hints.
Metadata
Metadata
Assignees
Labels
No labels