Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader doesn't return full multi-line texts #126

Closed
gaxweb opened this issue Nov 28, 2023 · 4 comments
Closed

Reader doesn't return full multi-line texts #126

gaxweb opened this issue Nov 28, 2023 · 4 comments
Labels

Comments

@gaxweb
Copy link
Contributor

gaxweb commented Nov 28, 2023

EDI text may span multiple lines by breaking it apart using the : character.

In the Reader::readEdiDataValue() method, a field like that will be spread across multiple array entries, because the EDI value is blindly split at every :.

Since you can't really know how many lines of text there will be beforehand, you can't really retrieve the full text via that method, only ever the 1st part up to the 1st line-break introduced by the :.

Example from a PRICAT file:

IMD+F+DS2+::91:The first line goes here :and the second one goes here:EN'

$reader->readEdiDataValue(['IMD', ['1' => 'F', '2' =>'DS2']], 3, 3) will only return the text The first line goes here .

Interestingly, the Analyzer does mark both array entries as description and the last one as language code.

@sabas
Copy link
Collaborator

sabas commented Nov 28, 2023

What's your use case for Reader? What you would like to achieve?

@gaxweb
Copy link
Contributor Author

gaxweb commented Nov 28, 2023

Well, I want to extract that line of text. What are you implying by your question?

I've just found https://www.truugo.com/edifact/d96a/imd/ which seems to indicate that the D96.A schema actually defines two lines. If that's true, which would mean that splitting lines isn't actually a feature, then I could at least handle it by first retrieving the 1st part and then just appending the 2nd part, if not empty.

@sabas
Copy link
Collaborator

sabas commented Nov 28, 2023

Not implying anything, I wanted to understand your use case and see if we can add a simpler way :) in my use cases usually I use the Interpreter class and I extract the information while looping the segments, are you looking to extract only that line?
Edit: this C273 is strange, other composite data elements are 35 characters fields only...

@gaxweb
Copy link
Contributor Author

gaxweb commented Nov 28, 2023

The text is actually hundreds of characters long, and the split occurs after 255 characters…

I actually hadn't even considered the Interpreter TBH. I think I initially dismissed it because I thought it would need more RAM to do it's thing, it being XML based. Thanks, I shall try and see how it does.

But I think I'll just do as I said, now that I've thought about it, and just concatenate the two sub-segments.

Since this doesn't actually seem to be an EDIFACT feature, I'll close this ticket.

@gaxweb gaxweb closed this as completed Nov 28, 2023
@sabas sabas added the wontfix label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants