<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Carlos,</div><div class=""><br class=""></div><div class="">Yes, that’s actually something I overlooked. The way the importers are constructed, you can’t actually access the queue of records to import from the configuration code. So, I posted an example of a workaround (and some workarounds for a few other issues with the way importers are sub-classed):</div><div class=""><br class=""></div><div class=""><a href="https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb" class="">https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb</a></div><div class=""><br class=""></div><div class="">Brian</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 10, 2015, at 12:44 AM, Carlos Lemus <<a href="mailto:carlos.lemus@unlv.edu" class="">carlos.lemus@unlv.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><font face="arial, helvetica, sans-serif" class="">Hello Brian,</font><div class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, helvetica, sans-serif" class="">Sorry if I'm not replying to our current thread correctly. I have yet to set up git for the plugin, but as soon as I do I will let you know. It is mostly some of the yale marcxml plugin setup and a lot of commented trial and error code at this point anyways. </font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, helvetica, sans-serif" class="">I tried the code you gave me and I think you understand perfectly what my issue is and I understand what you're trying to do by matching the agent to the current resource, exactly what I need. </font></div><div class=""><font face="arial, helvetica, sans-serif" class="">However, i</font><span style="font-family:arial,helvetica,sans-serif" class="">t's not working because the batch object seems to be Null. Not sure if maybe I'm required to import something.</span></div><div class=""><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre;background-color:rgb(51,51,51)" class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></span></div><div class=""><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre;background-color:rgb(51,51,51)" class=""><font face="arial, helvetica, sans-serif" class="">Error: #<NoMethodError: undefined method `working_area' for nil:NilClass></font></span></div><div class=""><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre;background-color:rgb(51,51,51)" class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></span></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class="">Here is the current state of my code </span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class=""><div style="" class=""><br class=""></div><div style="" class="">UNLVMarcXMLAgentsConverter.configure do |config|</div></span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class="">config["/record"][:map]["controlfield[@tag='001']"] = -> resource, node {</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>existing_agent_uri = resource.linked_agents.find {|link| link[:ref] =~ /people/ }</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>existing_agent = @batch.working_area.find {|obj| obj.uri == existing_agent_uri }</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>make(:name_person) do |name|</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>name.primary = node.xpath("subfield[@code='a']").inner_text</span></font></div><div class=""><span class="" style="white-space:pre;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif" class=""> </font></span></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span># add more name fields as necessary</span></font></div><div class=""><span class="" style="white-space:pre;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif" class=""> </font></span></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>val = node.inner_text</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>name['authority_id'] = val </span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>existing_agent.names << name</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span> end</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class=""><span class="" style="white-space:pre"> </span>}</span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px" class="">end</span><br class=""></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class="">Thanks for the quick reply by the way. I would have gotten to you sooner, but I didn't get an email </span></font><span style="line-height: 18.5714282989502px; white-space: pre; font-family: arial, helvetica, sans-serif;" class="">that you had replied. I'll keep an eye on the listserv from now on. </span></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class=""><br class=""></span></font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><span style="line-height:18.5714282989502px;white-space:pre" class="">Carlos Lemus</span></font></div></div>
</div></blockquote></div><br class=""></body></html>