Re: Barcode as a link report

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Barcode as a link report

muirunyeri
Hello Mark,
Thanks for pointing me to that direction. The itemnumber link does open the edit item page I was looking for. 
However if anybody would help me understand why I get an error (biblionumber is ambiguous) after adding any field from biblio table I'd be really grateful. This after correctly adding a left join for the biblios table using biblionumber on itemnumber in items.
Without the fields from biblio, the report works runs successfully.
Warm regards James


Sent from my Samsung Galaxy smartphone.-------- Original message --------From: Mark Alexander <[hidden email]> Date: 18/05/2020  16:06  (GMT+03:00) To: koha <[hidden email]> Subject: Re: [Koha] [koha] Barcode as a link report
Excerpts from muirunyeri's message of 2020-05-18 13:05:56 +0300:
> I'm looking to create a report with barcode as a link that when will clicked will open the edit items page.

There are some examples here that might help:

https://wiki.koha-community.org/wiki/SQL_Reports_Library#Links_by_item
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Reply | Threaded
Open this post in threaded view
|

Re: Barcode as a link report

Mark Alexander
Excerpts from muirunyeri's message of 2020-05-19 11:10:33 +0300:
> However if anybody would help me understand why I get an error (biblionumber is ambiguous) after adding any field from biblio table I'd be really grateful. This after correctly adding a left join for the biblios table using biblionumber on itemnumber in items.

It would help if you could post your entire query.  But my guess is
that the ambiguity is the result of joining two tables that have
fields with the same name.  The items and biblio tables both have a
field called biblionumber.  So in your query, you have to fix the
ambiguity by using the table name as a prefix: e.g.,
items.biblionumber or biblio.biblionumber .
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Reply | Threaded
Open this post in threaded view
|

Barcode as a link report

muirunyeri
Hello Mark,

Following up on this query, this is the whole SQL query

SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
additem.pl?op=edititem&biblionumber=', biblionumber, '&itemnumber=',
itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price

FROM items
LEFT JOIN biblioitems on
(items.biblioitemnumber=biblioitems.biblioitemnumber)
LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber)
WHERE items.barcode NOT LIKE 'K%'
AND  items.barcode NOT LIKE 'A%'
AND items.barcode NOT LIKE 'B%'
AND items.itype=<<itype|itemtypes>>
ORDER BY items.itemcallnumber asc

The error is as under:

*The following error was encountered:*
The database returned the following error:
Column 'biblionumber' in field list is ambiguous
Please check the log for further details.
Return to previous page
<http://127.0.1.1:8080/cgi-bin/koha/reports/guided_reports.pl?reports=37&phase=Run+this+report&param_name=itype%7Citemtypes&sql_params=BK#>

If I remove author and title fields, the report runs well. I however would
need the two fields.

Warm Regards

On Tue, May 19, 2020 at 2:28 PM Mark Alexander <[hidden email]> wrote:

> Excerpts from muirunyeri's message of 2020-05-19 11:10:33 +0300:
> > However if anybody would help me understand why I get an error
> (biblionumber is ambiguous) after adding any field from biblio table I'd be
> really grateful. This after correctly adding a left join for the biblios
> table using biblionumber on itemnumber in items.
>
> It would help if you could post your entire query.  But my guess is
> that the ambiguity is the result of joining two tables that have
> fields with the same name.  The items and biblio tables both have a
> field called biblionumber.  So in your query, you have to fix the
> ambiguity by using the table name as a prefix: e.g.,
> items.biblionumber or biblio.biblionumber .
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> [hidden email]
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Reply | Threaded
Open this post in threaded view
|

Re: Barcode as a link report

Katrin Fischer-2
Hi,

you have 2 tables in your query that both have a biblionumber column:
items and biblio.

So in your query, you need to specifiy which table is meant by adding
the name of the table it should use:

SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
additem.pl?op=edititem&biblionumber=', biblio.biblionumber,
'&itemnumber=', itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price

...


Hope this helps,


Katrin

On 29.05.20 14:20, muiru james wrote:

> Hello Mark,
>
> Following up on this query, this is the whole SQL query
>
> SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
> additem.pl?op=edititem&biblionumber=', biblionumber, '&itemnumber=',
> itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
> itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price
>
> FROM items
> LEFT JOIN biblioitems on
> (items.biblioitemnumber=biblioitems.biblioitemnumber)
> LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber)
> WHERE items.barcode NOT LIKE 'K%'
> AND  items.barcode NOT LIKE 'A%'
> AND items.barcode NOT LIKE 'B%'
> AND items.itype=<<itype|itemtypes>>
> ORDER BY items.itemcallnumber asc
>
> The error is as under:
>
> *The following error was encountered:*
> The database returned the following error:
> Column 'biblionumber' in field list is ambiguous
> Please check the log for further details.
> Return to previous page
> <http://127.0.1.1:8080/cgi-bin/koha/reports/guided_reports.pl?reports=37&phase=Run+this+report&param_name=itype%7Citemtypes&sql_params=BK#>
>
> If I remove author and title fields, the report runs well. I however would
> need the two fields.
>
> Warm Regards
>
> On Tue, May 19, 2020 at 2:28 PM Mark Alexander <[hidden email]> wrote:
>
>> Excerpts from muirunyeri's message of 2020-05-19 11:10:33 +0300:
>>> However if anybody would help me understand why I get an error
>> (biblionumber is ambiguous) after adding any field from biblio table I'd be
>> really grateful. This after correctly adding a left join for the biblios
>> table using biblionumber on itemnumber in items.
>>
>> It would help if you could post your entire query.  But my guess is
>> that the ambiguity is the result of joining two tables that have
>> fields with the same name.  The items and biblio tables both have a
>> field called biblionumber.  So in your query, you have to fix the
>> ambiguity by using the table name as a prefix: e.g.,
>> items.biblionumber or biblio.biblionumber .
>> _______________________________________________
>>
>> Koha mailing list  http://koha-community.org
>> [hidden email]
>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>>
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> [hidden email]
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Reply | Threaded
Open this post in threaded view
|

Re: Barcode as a link report

muirunyeri
Hi Katrin,

Thanks alot. It really helps and solves my case.

Most appreciated.

Warm regards
James

On Fri, May 29, 2020 at 11:59 PM Katrin Fischer <[hidden email]>
wrote:

> Hi,
>
> you have 2 tables in your query that both have a biblionumber column:
> items and biblio.
>
> So in your query, you need to specifiy which table is meant by adding
> the name of the table it should use:
>
> SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
> additem.pl?op=edititem&biblionumber=', biblio.biblionumber,
> '&itemnumber=', itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
>
> itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price
>
> ...
>
>
> Hope this helps,
>
>
> Katrin
>
> On 29.05.20 14:20, muiru james wrote:
> > Hello Mark,
> >
> > Following up on this query, this is the whole SQL query
> >
> > SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
> > additem.pl?op=edititem&biblionumber=', biblionumber, '&itemnumber=',
> > itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
> >
> itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price
> >
> > FROM items
> > LEFT JOIN biblioitems on
> > (items.biblioitemnumber=biblioitems.biblioitemnumber)
> > LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber)
> > WHERE items.barcode NOT LIKE 'K%'
> > AND  items.barcode NOT LIKE 'A%'
> > AND items.barcode NOT LIKE 'B%'
> > AND items.itype=<<itype|itemtypes>>
> > ORDER BY items.itemcallnumber asc
> >
> > The error is as under:
> >
> > *The following error was encountered:*
> > The database returned the following error:
> > Column 'biblionumber' in field list is ambiguous
> > Please check the log for further details.
> > Return to previous page
> > <
> http://127.0.1.1:8080/cgi-bin/koha/reports/guided_reports.pl?reports=37&phase=Run+this+report&param_name=itype%7Citemtypes&sql_params=BK#
> >
> >
> > If I remove author and title fields, the report runs well. I however
> would
> > need the two fields.
> >
> > Warm Regards
> >
> > On Tue, May 19, 2020 at 2:28 PM Mark Alexander <[hidden email]> wrote:
> >
> >> Excerpts from muirunyeri's message of 2020-05-19 11:10:33 +0300:
> >>> However if anybody would help me understand why I get an error
> >> (biblionumber is ambiguous) after adding any field from biblio table
> I'd be
> >> really grateful. This after correctly adding a left join for the biblios
> >> table using biblionumber on itemnumber in items.
> >>
> >> It would help if you could post your entire query.  But my guess is
> >> that the ambiguity is the result of joining two tables that have
> >> fields with the same name.  The items and biblio tables both have a
> >> field called biblionumber.  So in your query, you have to fix the
> >> ambiguity by using the table name as a prefix: e.g.,
> >> items.biblionumber or biblio.biblionumber .
> >> _______________________________________________
> >>
> >> Koha mailing list  http://koha-community.org
> >> [hidden email]
> >> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
> >>
> > _______________________________________________
> >
> > Koha mailing list  http://koha-community.org
> > [hidden email]
> > Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> [hidden email]
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
_______________________________________________

Koha mailing list  http://koha-community.org
[hidden email]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha