Hello John,

This part of the code is pulling data from the unapi.bre() function in the
DB, so in this case, you want 'copy_id', i.e.:

...
f => $copy->getAttribute('copy_id'),
...

This said, I think we'd all be interested to know exactly what you are
trying to accomplish, as there are other existing APIs for getting copy
IDs, so I am not sure if adding it into this SRU function is the easiest
way to go.

Sincerely,
Dan


On Tue, Jan 2, 2018 at 9:50 AM, John Merriam <jmerr...@biblio.org> wrote:

> Hello.  I am working in the perl module WWW/SuperCat.pm and trying to get
> the id of a row in asset.copy.  For some reason I am getting back what
> looks like an unAPI URI instead of just the id of the row.  I've been
> staring at this for a while and not sure why this is happening or the best
> way to fix it.  This is around line 2030 in my WWW/SuperCat.pm in EG
> 2.12.8.  The basic code flow in WWW/SuperCat.pm is:
>
> results retrieved from cstore
> my $marcxml = XML::LibXML->load_xml(...);
> my @copies;
> for my $node ($marcxml->getElementsByTagName('holdings')) {
>   for my $volume ($node->getElementsByTagName('volume')) {
>     for my $copy ($volume->getElementsByTagName('copy')) {
>       push @copies, {
>         f => $copy->getAttribute('id'),
>       };
>
> f ends up with unAPI stuff in it instead of just the row id that I am
> looking for.  It looks like:
>
> ftag:open-ils.org:U2@acp/5826234
>
> The part that I want is after the /   I put in a hack to manipulate the
> unAPI string and strip out the / and everything in front of it but I don't
> want to leave it that way.  I would like to do this the correct way.
>
> I'm not sure if it really is supposed to behave this way or not. Assuming
> it is, I was thinking maybe a function exists that can extract the row id
> from the unAPI URI?  I wasn’t able to find one.
>
> Any ideas how to correctly get just the real row id from the database
> without the unAPI stuff?
>
> Thanks in advance!
>
> --
>
> John Merriam
> Evergreen System Specialist
> Bibliomation, Inc.
> 24 Wooster Ave.
> Waterbury, CT 06708
> 203-577-4070 x108
>

Reply via email to