<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.talis.com/tdn" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Talis Developer Network - itm_rotate report - Comments</title>
 <link>http://www.talis.com/tdn/node/1594</link>
 <description>Comments for &quot;itm_rotate report&quot;</description>
 <language>en</language>
<item>
 <title>sorting by sequence and class mark in itm_rotate</title>
 <link>http://www.talis.com/tdn/node/1594#comment-417</link>
 <description>&lt;p&gt;I was asked about sorting by sequence and class mark in the itm_rotate script via email and thought my answer may be useful to this topic as well.&lt;/p&gt;
&lt;p&gt;This solution is making use of the preselect to sort the items to be rotated.&lt;/p&gt;
&lt;p&gt;Sequence does not require an additional join as the ITEM.SEQUENCE_ID attribute contains the sequence code e.g. JF, SOFT but the ITEM.CLASS_ID attribute is an id value.  To get the class number you would have to join the ITEM and CLASSIFICATION tables on the common CLASS_ID attribute and then use the CLASSIFICATION.CLASS_NUMBER attribute in the sort.&lt;/p&gt;
&lt;p&gt;Be aware that the sort would be the standard Sybase sorting so there is no control apart from ascending or descending order.  This may not be a problem but occasionally users want a slightly different order for local reasons e.g. numbers would file before alphabetical but users want it the other way.  &lt;/p&gt;
&lt;p&gt;The order in the order by statement is important.  In the example below if you wanted to sort by site then class number , then by sequence you would swap I.SEQUENCE_ID and  C.CLASS_NUMBER around in the list. &lt;/p&gt;
&lt;p&gt;The preselect would look something like this.&lt;/p&gt;
&lt;p&gt;print STDERR &quot;Selecting items that are due for rotation.. &quot;.&lt;br /&gt;
&quot;please wait..\n&quot;;&lt;/p&gt;
&lt;p&gt;my($query) = &quot;select I.ITEM_ID, I.ACTIVE_SITE_ID &quot;.&lt;br /&gt;
&quot;from ITEM I, ITEM_ROTATION_LINK L, WORKS W, CLASSIFICATION C&quot;.&lt;br /&gt;
&quot;where I.ITEM_ID = L.ITEM_ID &quot;.&lt;br /&gt;
&quot;and I.WORK_ID = W.WORK_ID &quot;.&lt;br /&gt;
&quot;and C.CLASS_ID = I.CLASS_ID &quot; .&lt;br /&gt;
&quot;and L.STATUS = 0 &quot;.&lt;br /&gt;
&quot;and L.CURRENT_PERIOD = &#039;T&#039; &quot;.&lt;br /&gt;
&quot;and L.DUE &lt;= &#039;$ShortCurrentDate&#039; &quot;;&lt;/p&gt;
&lt;p&gt;$query .= &quot;and I.ACTIVE_SITE_ID in ($locations) &quot;&lt;br /&gt;
if ($locations);&lt;/p&gt;
&lt;p&gt;$query .= &quot;order by I.ACTIVE_SITE_ID, I.SEQUENCE_ID, C.CLASS_NUMBER , W.AUTHOR_DISPLAY, W.TITLE_DISPLAY&quot;;&lt;/p&gt;
&lt;p&gt;(@preselect_data) = &amp;amp;sql($d, $query); &lt;/p&gt;
&lt;p&gt;I have included the author and title based attributes in the order by statement.  If you don&#039;t want to sort by those I would remove them from the order by list.&lt;/p&gt;
&lt;p&gt;As I said in the earlier posting such changes could have an effect on performance and any such changes should be tested on the MIS server first until you are happy with what is happening.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Brian Crampton&lt;br /&gt;
Developer, Talis&lt;/p&gt;
</description>
 <pubDate>Wed, 29 Nov 2006 10:00:28 +0000</pubDate>
 <dc:creator>Brian Crampton</dc:creator>
 <guid isPermaLink="false">comment 417 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>preselect</title>
 <link>http://www.talis.com/tdn/node/1594#comment-378</link>
 <description>&lt;p&gt;No you are entirely right.  Good catch.&lt;/p&gt;
&lt;p&gt;I was using a local version of the script where I must have been playing with the preselect.&lt;/p&gt;
&lt;p&gt;I have updated the earlier posting to avoid any confusion&lt;/p&gt;
&lt;p&gt;Brian Crampton&lt;br /&gt;
Developer, Talis&lt;/p&gt;
</description>
 <pubDate>Thu, 28 Sep 2006 16:55:21 +0100</pubDate>
 <dc:creator>Brian Crampton</dc:creator>
 <guid isPermaLink="false">comment 378 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>Is this incorrect?</title>
 <link>http://www.talis.com/tdn/node/1594#comment-377</link>
 <description>&lt;p&gt;Brian,  I have just tried this and it didn&#039;t produce any results.  &lt;/p&gt;
&lt;p&gt;On closer examination, I saw that in the main.pl, the preselect section showed the L.DUE &#039;LongPastDate&#039; to be L.DUE  &#039;ShortCurrentDate&#039;.&lt;/p&gt;
&lt;p&gt;I altered it and it now works great.&lt;/p&gt;
&lt;p&gt;Thanks&lt;br /&gt;
Mark&lt;/p&gt;
&lt;p&gt;http://www.wirral-libraries.net/&lt;br /&gt;
http://www.stembystem.co.uk/&lt;/p&gt;
</description>
 <pubDate>Thu, 28 Sep 2006 15:36:01 +0100</pubDate>
 <dc:creator>markhughes</dc:creator>
 <guid isPermaLink="false">comment 377 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>modifying the preselect</title>
 <link>http://www.talis.com/tdn/node/1594#comment-364</link>
 <description>&lt;p&gt;The complete code goes after the first { and before the return(0);&lt;/p&gt;
&lt;p&gt;You then have to change the zero in the return statement to 1 e.g.&lt;/p&gt;
&lt;p&gt;return(1);&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;http://www.talis.com/scripts&quot;&gt;Talis Scripts&lt;/a&gt; section there is an area (Scripts/Perl MIS reports/About MIS reports) on setting up a local area and making &lt;a href=&quot;http://www.talis.com/services/documentation/docs/sysman/webhelp/scripts/tailoring_selection_criteria.htm&quot;&gt;changes to the preselect or selection criteria&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Brian Crampton&lt;br /&gt;
Developer, Talis&lt;/p&gt;
</description>
 <pubDate>Wed, 20 Sep 2006 15:28:38 +0100</pubDate>
 <dc:creator>Brian Crampton</dc:creator>
 <guid isPermaLink="false">comment 364 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>Itm_rotate report</title>
 <link>http://www.talis.com/tdn/node/1594#comment-363</link>
 <description>&lt;p&gt;Brian,&lt;/p&gt;
&lt;p&gt;In the current preselect.pl there are the following lines:&lt;br /&gt;
--------------------&lt;br /&gt;
sub preselect&lt;br /&gt;
{&lt;br /&gt;
        return(0);&lt;br /&gt;
}&lt;br /&gt;
1;&lt;br /&gt;
--------------------&lt;/p&gt;
&lt;p&gt;Do I just remove these lines and replace with your code?&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;
Mark&lt;/p&gt;
&lt;p&gt;http://www.wirral-libraries.net/&lt;br /&gt;
http://www.stembystem.co.uk/&lt;/p&gt;
</description>
 <pubDate>Wed, 20 Sep 2006 14:52:43 +0100</pubDate>
 <dc:creator>markhughes</dc:creator>
 <guid isPermaLink="false">comment 363 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>Thanks Brian</title>
 <link>http://www.talis.com/tdn/node/1594#comment-356</link>
 <description>&lt;p&gt;Thanks for that Brian,&lt;/p&gt;
&lt;p&gt;I&#039;ll give it a try on our MIS Server.&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;
Mark&lt;/p&gt;
&lt;p&gt;http://www.wirral-libraries.net/&lt;br /&gt;
http://www.stembystem.co.uk/&lt;/p&gt;
</description>
 <pubDate>Tue, 19 Sep 2006 09:12:16 +0100</pubDate>
 <dc:creator>markhughes</dc:creator>
 <guid isPermaLink="false">comment 356 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>sorting the itm_rotate output</title>
 <link>http://www.talis.com/tdn/node/1594#comment-354</link>
 <description>&lt;p&gt;Looking at the script the only sort appears to be in the preselect where the items to be rotate are selected and then ordered by the items ACTIVE_SITE_ID.  This sort is done so that the report can be grouped by site.  From this sorted list of items each item is then processed to get the details about rotation and the bibliographic/sequence details and then the details sent to the output file.&lt;/p&gt;
&lt;p&gt;The order you are seeing with each site is just the order it comes back in while it should be in the order you list.  There is a defect referenced in &lt;a href=&quot;http://www.talis.com/services/talissolutions/solution_index.php?solution=itm_rotate%20output%20file&quot;&gt;Talis Solutions&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The script needs to be changed so that the results for each item are stored in an array within PERL, sorted and then sent to the output.  This is potentially quite a rewrite of the script.&lt;/p&gt;
&lt;p&gt;A quick work around would be to use the following as a local preselect&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
print STDERR    &quot;Selecting items that are due for rotation.. &quot;.&lt;br /&gt;
                                &quot;please wait..\n&quot;;&lt;/p&gt;
&lt;p&gt;                my($query) =    &quot;select I.ITEM_ID, I.ACTIVE_SITE_ID &quot;.&lt;br /&gt;
                                &quot;from   ITEM I, ITEM_ROTATION_LINK L, WORKS W&quot;.&lt;br /&gt;
                                &quot;where  I.ITEM_ID = L.ITEM_ID &quot;.&lt;br /&gt;
                                &quot;and    I.WORK_ID = W.WORK_ID &quot;.&lt;br /&gt;
                                &quot;and    L.STATUS = 0 &quot;.&lt;br /&gt;
                                &quot;and    L.CURRENT_PERIOD = &#039;T&#039; &quot;.&lt;br /&gt;
                                &quot;and    L.DUE &lt;= &#039;$ShortCurrentDate&#039; &quot;;&lt;/p&gt;
&lt;p&gt;                $query .= &quot;and  I.ACTIVE_SITE_ID in ($locations) &quot;&lt;br /&gt;
                                                                if ($locations);&lt;/p&gt;
&lt;p&gt;                $query .= &quot;order by I.ACTIVE_SITE_ID, W.AUTHOR_DISPLAY, W.TITLE_DISPLAY&quot;;&lt;/p&gt;
&lt;p&gt;                (@preselect_data) = &amp;amp;sql($d, $query); &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This will sort the items by item site then author display and then title display.  This is not the ideal solution and could affect performance of the script depending on the size of database.  While it would be possible to sort on other criteria it would involve linking in other tables which could be problematic. The best solution is to sort within the PERL script itself.&lt;/p&gt;
&lt;p&gt;If you want to try it please test fully on the MIS server before going live and remember to use a local version of the itm_rotate script.&lt;/p&gt;
&lt;p&gt;Brian Crampton&lt;br /&gt;
Developer, Talis&lt;/p&gt;
</description>
 <pubDate>Tue, 19 Sep 2006 08:58:12 +0100</pubDate>
 <dc:creator>Brian Crampton</dc:creator>
 <guid isPermaLink="false">comment 354 at http://www.talis.com/tdn</guid>
</item>
<item>
 <title>itm_rotate report</title>
 <link>http://www.talis.com/tdn/node/1594</link>
 <description>&lt;p&gt;Anyone know of a way of changing the sort order for the itm_rotate script?  Currently it defaults to Sequence code, size code, class number and suffix.  I would like to be able to change this order to say AUTHOR and TITLE.&lt;/p&gt;
&lt;p&gt;Any ideas?  I&#039;m not well up on perl.&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;
Mark&lt;/p&gt;
</description>
 <comments>http://www.talis.com/tdn/node/1594#comments</comments>
 <category domain="http://www.talis.com/tdn/taxonomy/term/60">Talis Library System</category>
 <pubDate>Mon, 18 Sep 2006 16:35:32 +0100</pubDate>
 <dc:creator>markhughes</dc:creator>
 <guid isPermaLink="false">1594 at http://www.talis.com/tdn</guid>
</item>
</channel>
</rss>
