[SOLVED] Query works correctly, report shows wrong data

SOLVED! I’ve posted a reply with the fix in case someone else needs it!

Heya!

I’m not used to dealing with databases, but I’ll try explaining myself the best I can.

I’ve created a table with data of some authors, their books’ titles, publishers, etc. I’ve also created a query to ask for a user input and based on that input, find the matching entries. It goes like this:

SELECT * FROM “LISTADO DUPLICADOS” WHERE “AUTOR” LIKE ‘%’ || :AUTOR || ‘%’

And that actually works! However, when using a report to get the data from that query, the names are kinda… well, wrong. See, the entries are correct, but it swaps certain names for whatever I’ve written in the input. So for example, if in the report’s input I look for “isa”, this is the result:

imagen

Instead of “isa”, it should be showing the full names, like “SMITH, ISABELLE”.
I’ve tried using a different query to check for the publishers, but the result is always the same, even with different entries. It even seems to have the very same order all the time: 2 wrong, 1 right, 1 wrong, 1 right, 1 wrong, 1 right, eventually 2 right, etc.

I’ve tried using the previous query, which was very basic but worthless to me, but at least it used to work… until now. This is what I was using:

SELECT * FROM “LISTADO DUPLICADOS” WHERE “AUTOR” = :AUTOR

Ah well, that’s it. Thanks for reading!

EDIT: I’ve tried running the reports on OpenOffice just in case, but I get the same results.

BerlinStreets_LO7.odb (580.7 KB)
I reproduced a similar database with street names but can not reproduce your issue.
Query “Query_Report” and the equally named report uses the filter criterion that has been entered into the form.
Query “Query_Filter” and the equally named report picks the filter criterion from the parameter input box.

1 Like

The issue was the fact both the column and the input had the same name in the SQL statement. Changing either to something else worked (tho ofc if you change the name of the column, you also have to update it on the SQL statement)

:upside_down_face:
Yes, quite obvious if you know it.

1 Like