<HTML ><HEAD ><TITLE >yaz_sort</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="YAZ functions" HREF="ref.yaz.html"><LINK REL="PREVIOUS" TITLE="yaz_set_option" HREF="function.yaz-set-option.html"><LINK REL="NEXT" TITLE="yaz_syntax" HREF="function.yaz-syntax.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.yaz-set-option.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.yaz-syntax.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.yaz-sort" ></A >yaz_sort</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN98100" ></A ><P > (PHP 4 >= 4.1.0)</P >yaz_sort -- Sets sorting criteria</DIV ><DIV CLASS="refsect1" ><A NAME="AEN98103" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >yaz_sort</B > ( resource id, string criteria)<BR ></BR ><P > This function sets sorting criteria and enables Z39.50 Sort. Call this function <SPAN CLASS="emphasis" ><I CLASS="emphasis" >before</I ></SPAN > <A HREF="function.yaz-search.html" ><B CLASS="function" >yaz_search()</B ></A >. Using this function alone doesn't have any effect. When in conjunction with <A HREF="function.yaz-search.html" ><B CLASS="function" >yaz_search()</B ></A >, a Z39.50 Sort will be sent after a search response has been received and before any records are retrieved with Z39.50 Present. The <TT CLASS="parameter" ><I >criteria</I ></TT > takes the form </P ><P > <TT CLASS="replaceable" ><I >field1 flags1 field2 flags2</I ></TT > ... </P ><P > where field1 specifies primary attributes for sort, field2 seconds, etc.. The field specifies either numerical attribute combinations consisting of type=value pairs separated by comma (e.g. <TT CLASS="literal" >1=4,2=1</TT >) ; or the field may specify a plain string criteria (e.g. <TT CLASS="literal" >title</TT >. The flags is a sequnce of the following characters which may not be separated by any white space. </P ><P ></P ><DIV CLASS="variablelist" ><P ><B >Sort Flags</B ></P ><DL ><DT ><TT CLASS="literal" >a</TT ></DT ><DD ><P >Sort ascending</P ></DD ><DT ><TT CLASS="literal" >d</TT ></DT ><DD ><P >Sort descending</P ></DD ><DT ><TT CLASS="literal" >i</TT ></DT ><DD ><P >Case insensitive sorting</P ></DD ><DT ><TT CLASS="literal" >s</TT ></DT ><DD ><P >Case sensitive sorting</P ></DD ></DL ></DIV ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN98146" ></A ><P ><B >Example 1. Sort Criterias</B ></P ><P > To sort on Bib1 attribute title, case insensitive, and ascending you'd use the following sort criteria: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >1=4 ia</PRE ></TD ></TR ></TABLE > </P ><P > If the secondary sorting criteria should be author, case sensitive and ascending you'd use: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >1=4 ia 1=1003 sa</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.yaz-set-option.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.yaz-syntax.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >yaz_set_option</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.yaz.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >yaz_syntax</TD ></TR ></TABLE ></DIV ></BODY ></HTML >