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

Splitting multi-valued fields on item_delim #50

Open
adamstegman opened this issue Sep 2, 2015 · 5 comments
Open

Splitting multi-valued fields on item_delim #50

adamstegman opened this issue Sep 2, 2015 · 5 comments

Comments

@adamstegman
Copy link

We have to do (seg.field || "").split(seg.item_delim) a lot, and it's pretty silly. What would a good API to do this from the gem look like?

Ideally it would be something like obx.units[4], but that would break the existing API and might be confusing when some fields are arrays and some are strings. So maybe this should be a new method.

What about something like HL7::Message::Segment.split_field(obx.units)? It's quite verbose but I'm not sure where else to hang the function. It should handle nil and return an empty array.

Does anyone have any thoughts about this?

@jeremiemv
Copy link

👍

@mogox
Copy link
Member

mogox commented Sep 14, 2015

What do you think about something like obx.fetch_field(:units, 4)? With the option of sending a third parameter as a default value just like fetch. What you think?

@adamstegman
Copy link
Author

Oh, that sounds great! 👍

@Stratus3D
Copy link

👍

@micred
Copy link

micred commented Jun 24, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants