<div dir="ltr">Thank you both. Nancy, that could work. Essentially, we just want to locate all our onsite restricted boxes for a potential staff project and we want to know why the box is restricted. e.g. A box with a restriction based on required playback equipment gets different treatment than one with private information. <br><div><br></div><div>We are actually right now in the process of upgrading from 2.8.1 to 3.2.0 so will have the download CSV capability through manage top containers next week. I think the method you suggest could work, but it seems I would have to query for each of our restriction types.</div><div><br></div><div>Alternately I may need to recreate some kind of loop query I thought might be possible manually in a spreadsheet by checking every parent_id in the archival object record attached to an onsite box to see if the parent of an archival object is restricted. I would do this using VLOOKUP by comparing to a table of restricted AOs that includes the AO id and restriction type of all AOs with a local access restriction. If an AO's parent is restricted, add that object to the restricted table with its parent's restriction type. Keep repeating for 11 iterations (I know our components go to c11 in EAD).</div><div><br></div><div>Or I might be able to implement a stored procedure, as Andrew suggests, since I think we'll want to be able to access the information semi-regularly, but I'm not sure how to do that yet.</div><div><br></div><div>Thank you both!</div><div><br></div><div>-Olivia</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 19, 2022 at 12:32 PM Kennedy, Nancy <<a href="mailto:KennedyN@si.edu">KennedyN@si.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_3333629417579664852WordSection1">
<p class="MsoNormal">Olivia –<u></u><u></u></p>
<p class="MsoNormal">Not a database query, but in case it helps: I have had some success by searching in Manage Top Container using the restriction enumeration values.  For example, if you have used the local restriction “InProcessSpecColl”, you can search
 that as a keyword.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Mileage will vary depending on the detail you need, especially given the pitfalls of keyword searches. But, this can work in a pinch if you are only trying to search within 1 repository at a time, and only need a list of the Boxes, Resources/Accessions,
 or other high level detail.  A Download CSV option is also available to export some of the result details, depending on which aspace version you’re on.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Nancy<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> <a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org" target="_blank">archivesspace_users_group-bounces@lyralists.lyrasis.org</a> <<a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org" target="_blank">archivesspace_users_group-bounces@lyralists.lyrasis.org</a>>
<b>On Behalf Of </b>Andrew Morrison<br>
<b>Sent:</b> Tuesday, April 19, 2022 12:13 PM<br>
<b>To:</b> <a href="mailto:archivesspace_users_group@lyralists.lyrasis.org" target="_blank">archivesspace_users_group@lyralists.lyrasis.org</a><br>
<b>Subject:</b> Re: [Archivesspace_Users_Group] Query to retrieve boxes with restricted AOs + local access restrict type<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="line-height:12pt;background:rgb(255,235,156)">
<b><span style="font-size:9pt;color:rgb(156,101,0)">External Email - Exercise Caution</span></b><u></u><u></u></p>
<div>
<p>If you need to ascend the hierarchy of archival objects within collections, from the ones that link to containers, to the ones with the access restrictions, then you are probably going to need to write a stored procedure.<u></u><u></u></p>
<p>Andrew.<u></u><u></u></p>
<p><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 19/04/2022 15:38, Olivia S Solis wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">Hello all, <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I'm spending an inordinately long time trying to form a query to retrieve all boxes attached to restricted archival objects in ASpace. I'm hoping someone in the group with more advanced database skills than I have can help me out.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">We want to identify any box in a certain building that has restricted materials and the kind of local access restriction it has. Since we use local access restrictions, the AO that is linked to the box may not have the local access restriction applied
 through the accessrestrict note, but a parent AO will. That parent may or may not be its immediate parent AO. We only care about the collection title in the box, not the AO title.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I've come up with this query, which is already a mouthful, to retrieve all the boxes + their collections in the building I want (SRH2):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">SELECT DISTINCT
<a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Frr.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=nk%2BmdUeMDDPoIfICYeEmZEkbHWLiA2tgx0a7yUJRh%2Fg%3D&reserved=0" target="_blank">
rr.id</a>, rr.title, t.indicator, r.top_container_id, t.barcode, l.title</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">FROM instance as i</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN sub_container as s</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fi.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=q4SLEjyA4n0SCKgcMDhy42NK3E7IeLGKBRZkIaZyOrw%3D&reserved=0" target="_blank">
i.id</a> = s.instance_id</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN archival_object as a</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fa.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=8%2FV0Kz8QtFEFIug45llUUkgEFKd1AUKsKogafHq2d6E%3D&reserved=0" target="_blank">
a.id</a> = i.archival_object_id</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container_link_rlshp as r</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=QZEkrnzpqaut58MXw6ZBHgMZMb5Ak1TMpYOfFryibUA%3D&reserved=0" target="_blank">
s.id</a> = r.sub_container_id</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container as t</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ft.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=GarT1h395FHJJmXcVKT%2FMx93ZQQh7H4wqJ2%2FBBexFPU%3D&reserved=0" target="_blank">
t.id</a> = r.top_container_id</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">LEFT JOIN resource as rr</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Frr.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=nk%2BmdUeMDDPoIfICYeEmZEkbHWLiA2tgx0a7yUJRh%2Fg%3D&reserved=0" target="_blank">
rr.id</a> = a.root_record_id</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container_housed_at_rlshp as tcha</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON tcha.top_container_id =
<a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ft.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=GarT1h395FHJJmXcVKT%2FMx93ZQQh7H4wqJ2%2FBBexFPU%3D&reserved=0" target="_blank">
t.id</a></span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN location as l</span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fl.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=rpkYl05VCFAGQgAAyu5AK3LJC%2FDZEERzS%2FvDOvslBaE%3D&reserved=0" target="_blank">
l.id</a> = tcha.location_id </span><u></u><u></u></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">WHERE l.building LIKE "SRH2"</span><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">On top of this I want the archival objects in the query to reflect only AOs that have a local access restriction or who have an immediate or distant parent AO with one. This is the query I have that will ID AOs with a local access restriction,
 which I realize I'll have to extract from the JSON that is in the notes column of the note table:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">SELECT id, resource_id, archival_object_id, notes FROM note WHERE notes LIKE '%local_access_restriction_type":["%';</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Any help would be appreciated. Thank you!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">-Olivia<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Olivia Solis, MSIS (she/her)</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Metadata Coordinator</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Dolph Briscoe Center for American History</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">The University of Texas at Austin</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">2300 Red River St. Stop D1100</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Austin TX, 78712-1426</span><span style="font-size:9.5pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">(512) 232-8013</span><span style="font-size:9.5pt;color:rgb(136,136,136)"><u></u><u></u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<pre>_______________________________________________<u></u><u></u></pre>
<pre>Archivesspace_Users_Group mailing list<u></u><u></u></pre>
<pre><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" target="_blank">Archivesspace_Users_Group@lyralists.lyrasis.org</a><u></u><u></u></pre>
<pre><a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flyralists.lyrasis.org%2Fmailman%2Flistinfo%2Farchivesspace_users_group&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=EBhTj9hEHqJYVQog%2BgQKMjeKC86X0Ju93jIjPS0RX8I%3D&reserved=0" target="_blank">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><u></u><u></u></pre>
</blockquote>
</div>
</div>
</div>

_______________________________________________<br>
Archivesspace_Users_Group mailing list<br>
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" target="_blank">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br>
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" rel="noreferrer" target="_blank">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><font color="#000000">Olivia Solis, MSIS (she/her)</font></div><div style="font-size:12.8px"><font color="#000000">Metadata Coordinator</font></div><div style="font-size:12.8px"><font color="#000000">Dolph Briscoe Center for American History</font></div><div style="font-size:12.8px"><font color="#000000">The University of Texas at Austin</font></div><div style="font-size:12.8px"><font color="#000000">2300 Red River St. Stop D1100</font></div><div style="font-size:12.8px"><font color="#000000">Austin TX, 78712-1426</font></div><div style="color:rgb(136,136,136);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">(512) 232-8013</span></div></div></div></div></div></div></div>