[Koha] Set report sort order at runtime

Cab Vinton bibliwho at gmail.com
Tue Apr 24 04:33:45 NZST 2018


Thanks, Owen.

Some quick Googling turned up several solutions that rely on setting a
variable & then using CASE WHEN syntax. Tried this but Koha threw an
error on the SET statement :-(

SET @OrderByColumn = 'AddedDate'
.
 ORDER BY
      CASE WHEN @OrderByColumn='AddedDate' THEN
CONVERT(varchar(50),AddedDate)
           WHEN @OrderByColumn='Visible' THEN CONVERT(varchar(2), Visible)
           WHEN @OrderByColumn='AddedBy' THEN AddedBy
           WHEN @OrderByColumn='Title' THEN Title
      END

Ah well.


On Mon, Apr 23, 2018 at 9:31 AM, Owen Leonard <oleonard at myacpl.org> wrote:
>> as SQL turned this into:
>>
>> ORDER BY 'itemcallnumber'
>
> As you have discovered, Koha will try to put your strings into quotes
> on the assumption that you're submitting something for some kind of
> matching purposes.
>
> I agree that it would be a nice option for parameters.
>
>  -- Owen
>
> --
> Web Developer
> Athens County Public Libraries
> http://www.myacpl.org
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha


More information about the Koha mailing list