I have the fields plugin to display my books in the index.gsp view.
My book domain have a publishedDate Date field.
<f:table collection="${bookList}"/>
<div class="pagination">
<g:paginate total="${bookCount ?: 0}" />
</div>
The plugin will show my books in the table 10 rows at a time. The problem is if I click the Published Date column header to sort my books, some of the books will be missing from the table.
I try to troubleshoot the problem. I have 8 books that were published at the same date. So, I change the book titles to just 1,2,3, up to 8. So, I will see which books are missing.
The plugin shows book 1,4,2,3,5 in the first page, and book 8 and 5 in the second page in this order.
Book 6 is missing. Book 5 is being showed twice in page 1 and page 2.
If I click the column again to sort my books in descending order, book 4, 5, 6, 1 are showed in the second last page, and 2, 3, 5, 4, 6 are showed in the last page. Book 4, 5, and 6 are being showed twice.
If I don't click any column to sort the rows, all 8 books will be showed without any problem.
How to troubleshoot this wrong records problem?
The problem is if I click the Published Date column header to sort my
books, some of the books will be missing from the table.
There really is no good way to know for sure what is going wrong in your app with just that information. It is likely that your app is configured so when you click the column header a request is being made to the server which will create a model which will drive the view. There are any number of things that might be wrong with that code.
How to troubleshoot this wrong records problem?
I would inspect the model that is being generated when you click the column header and the back from there into the query that is retrieving the records. That will likely highlight was is going wrong.
I have tracked down the source of the problem. The problem is with the LIMIT offset, max SQL statement.
This is my troubleshooting steps.
I am using Heidisql. I can also click the header to sort the records in Heidisql. Heidisql will show the SQL statement. This is the SQL.
SELECT * FROM `book` ORDER BY `published_date` ASC LIMIT 1000;
The records come back in the order I am expecting. So, I track the SQL sent from the fields plugin when I click the header column and the Next button. This is basically what the plugin send to the database.
SELECT * FROM `book` ORDER BY `published_date` ASC LIMIT 10,10
So, I copy and paste this SQL to Heidisql to see what the records will look like. Surprisingly, the records come back all messed up too.
Now I know what the problem is. I cannot sort my records just by using a single column. This is what the plugin sent to the database. There is not enough information to sort the records correctly. The ASC LIMIT statement makes a best guess to sort the records in this case. That is why the records come back wrong.
I will need to make the plugin to send more than 1 column to help the sorting.
Related
amazing experts.
I am still very new to Crystal, and only do it on the odd occasion, and seem to be going around in circles with this issue.
I work for a charity, and we would like to pull off a list of all our past donors who have not donated anything on the last 6 months.
I have tables for customer details, linked to another tables which shows their orders. They are linked based on the unique customer ID.
I have added all the customer orders, grouped by customer ID and then sported by OrderDate, and now I get stuck.
In my mind, I need to exclude anyone who has an order date that is less than 6 months old, and to do so I have tried using
{OrderDate} <= DateAdd ("m", -6, CurrentDate).
This however only seems to remove the customer orders that are less than 6 months old, not remove the customer records themselves.
I have tried using it both the "Select Expert" and also to suppress in the "Section Expert", but neither seem to be working to exclude the relevant Customer records.
I am certain there is a super easy way to do this, and I will kick myself when I know how to do it, but right now I have gone round the houses trying to find the solution.
So, if anyone out there has done this before and can help me out, i would greatly appreciate it.
Thank you all for your time!
this might solve your problem.
create a running summary field to count the number of rows return per group. if it is zero under the group section, under suppress , edit formula at put > 0
and run the report.
I need to build a search form including some fields like "city, price range, key word and date". I saw this video which is recommending to create a "searches" table. Every time any user made a search, it creates a table row in the db, and show the results depending on the submitted fields.
Seems easy to build but is it safe? I mean, if this is used in the practical world, I think we also have to use "I'm not robot" from Google.
https://www.youtube.com/watch?v=QRE7KxIvUb4&t=29s
Any idea is welcome.
I work on a mobile app which shows a stream of data fetched from the server. Initially the app fetches first page with 10 items. When user scrolls down, the app fetches the second page with next 10 items (in other words - infinite scroll). The problem I have is that when the user A fetches page number X it is possible, that the user B creates a new content on the server which modifies the resultset available for the user A. This means that if the user A tries to fetch X+1 page, it will contain previous item(s) which were "pushed back" by the new content. How to solve it? I came out with two solutions but I don't know which is better:
the mobile app remembers ids of already shown items and if in the next page there is an item which was already shown, it is not shown again.
the app remembers date of creation of the first item from the first page. When it fetches next pages, it additionaly sends this date to the server which adds this date to the sql query in order to maintain the same resultset
What do you think? Which is better? Are there better solutions?
UPDATE:
Imagine that I have a table 'queries' with columns 'queries_id' (integer, primary key), 'date_created' (timestamp). My query looks like this: select * from queries order by date_created desc. It is not true that date_created date_created increments with primary key incremenatation. I paginate data with Spring Data using Pageable object. Now the problem is that if new rows are created and they have date_created newer then previous newest row then they modify resultset.
This happens because you do the pagination based only on the date_created.
I assume that you do your query with ORDER BY date_created DESC and you offset for the current page.
To avoid your problem you need to add the last id of the previous fetch in your query. I.e. queries_id < last_id ORDER BY date_created .... etc
I have a Count query that uses multiple criteria to produce a result looking like:
count ID
1 "abc"
4 "bcd"
5 "def"
1 "cde"
This shows how many times the ID appears in a given database. The datasource is through an odbc connection that updates automatically. So the ID values change everytime it is opened. I would like to try to turn the unique ID or the associated count into a hyperlink that when clicked will return all information involved in the count (*note the database has much more information associated with the ID's than is counted, a date range of the previous three months is applied.) Can this be done simply?
Database format:
ID Instance Device DateBeg DateEnd
Thanks in advance,
LP
The short version -
This should be simple to do using a report (but could also be done using a form I will be explaining how to do a report for this version). You would just make a report that includes all of your fields then call the report on click. It is important to mention that you will need to view the query via a form to make this work.
A more detailed version -
The first step will be to make a form based on your query (you will not be able to do this directly from a query). To do this select your query then click on the create tab then click Multiple Items Form. Adjust as needed.
Then create a report that shows ALL of the records how you want it to display. (I will call it rpt_ViewDetails) (we will limit later)
When you are done adjusting click on the field that contains the "abc" etc. results (if this is a calculated field it will be more complicated.) I will call this field "Criteria" for the example. Go to the events tab on the property sheet (in design view). use the On Dbl Click event and go to code builder.
This is what the code would look like (place in between the private sub.... and the end sub lines of code):
DoCmd.OpenReport "frm_ViewDetails", acViewNormal, , "[Criteria] = " & Me.Critera
Let me know if you have any trouble with this, also let me know if the structure is different than I am assuming, I will need a more detailed report of what the query is doing if this is the case, what the structure of the database is etc.
I need create a crystal report to report the column across not down. The report itself is very simple, there is no need to group and summarize. The only thing is different from regular report is it need display the column across rather than down. I try use cross-tab, or multiple columns with no success. is there any way i can make is down in crystal? Thanks
The regular report with column down:
I need display like these:
try the following
put the the 4th names of the first column in the page header and make that section underlay the following section, then create 4 details sections, one per column and put the values values right next below and make the details to grow across then down.
for instance
page header
Mth
Vendor
Trans#
Amt
end of page header
details1 date field
details2 vendor field
details3 trans field
details4 amt field