Skip to content

Segment is ambiguous #117

@gaxweb

Description

@gaxweb

First problem

Example excerpt from a PRICAT file of a line item:

IMD+F+TPE+::91:UNISEX'
IMD+C+CL+8:EAS'
IMD+C+98+40::91'
IMD+C+UP5+J::91'
IMD+C++CU'
IMD+F+35+::91:ATLANTIC'
IMD+C+35+423041::91'
IMD+F+ANM+::91:ANDROS'
IMD+F+MD+::91:VENEZIA'
IMD+F+XB2+::91:01575423041.JPG'

I'm trying to extract the ATLANTIC string, but I can't seem to find an exact filter for it. $r->readEdiDataValue(['IMD',['1'=>'F', '2'=>'35']],1); doesn't do it but finds 7 matches: 5 for "F" in 1st place + 2 for "35" in 2nd.

Is it even possible? The code for readEdiDataValue() doesn't seem to combine the filters in the array, but just look for lines that match either, but not both at the same time.

Shouldn't that code combine filters via AND instead of OR? RIght now it breaks the inner loop, if the 1st entry in the filter array is "ok" without checking, if the 2nd entry matches, too.

I've got a patch ready, if you agree that this should be changed. With my change applied, $r->readEdiDataValue(['IMD', [1 => 'F', 2 => '35']], 3, 3); gets me the "ATLANTIC" string I wanted.

Second problem

From same PRICAT line item:

ALI+++96E'
ALI+DE'

How would I even filter these, if I need the "DE" string? Just "ALI" is ambiguous but the 2nd entry already contains what I need. Can you filter on "not empty"? Or is that an error and there should really just be one line containing both data points? Seems weird to have 2 "ALI" lines like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions