Grouping data by date in ireport - java

I made ​​a report as of the date of purchase transactions.
I want to display the format as below:
In pictue above the date is only displayed once at the top.
Now, the date shown in each record that appears.
I already have the solution using subreport. In my report i select distinct for the date. And subreport using parameter from primary report.
But the problem now is, the data in each date is duplicate in every row.
How to handle that?

You can use Subreport to do this. Example i will have two sql, the first sql i will call DISTINCT all date and then the second sql (use for subreport) i will get all data have date like date in the first sql (using parameter). (Sorry my English is not good, i can'tardescrip all for you :).)

Related

To store date consistently in one format in VARCHAR column

I am working with an OAF extension in Oracle EBS. We have attribute columns (varchar datatype) provided by Oracle where we can store additional data. We need to store two date fields which are entered by the user.
In the OAF Java page, when user selects the date from the calendar pick and hit save it stores in the format - YYYY-MM-DD in the DB table. eg 2022-05-22
But while being retrieved I need to show that as MM/DD/YYYY to show the dates in alignment in OAF page. The problem here is that next time (2nd time onwards) when we try to save (not by selecting the calendar again as dates are already populated in the view) it's saved in the format MM/DD/YYYY. And there onwards the below view query fails.
select TO_CHAR(TO_DATE(2022-05-22, 'YYYY/MM/DD'),'MM/DD/YYYY') from dual;
Is there a way I can always enforce to store the value as MM/DD/YYYY either in the JAVA code or the PL/SQL Package that's being called. I am basically retrieving the field value in JAVA and invoking the PL/SQL procedure to update it in the table.
DBUtil.setString((OraclePreparedStatement)oracleCallableStatement, b1++, busClassVORowImpl.getAttribute1())
DBUtil.setString((OraclePreparedStatement)oracleCallableStatement, b1++, busClassVORowImpl.getAttribute2())

I'm trying to filter firestore content on basis on of a date picked by user. Say Display all data for 14th Feb

I'm trying to get the user to pick a date and then on click of a button will display all the content from Firestore related to that data.
Here mDisplayDate is a DatePicker Dialog and I want to display the data. I've done the display part but whereEqualTo() takes two hard coded strings as field and value.
noteBookref.whereEqualTo("Date" , mDisplayDate.toString()).orderBy("Date", Query.Direction.DESCENDING).get();
The Database looks like this
I'm trying to filter firestore content on basis on of a date picked by user. Say Display all data for 14th Feb
You are storing the Date property as a String you are doing it wrong.
To be able to query your database according to a specific date, your Date property should be o type Date and not String. To see how you can achieve this, please take a look at my answer from this post.
Once you have the property set correctly, a query like this should do the trick:
noteBookref.whereEqualTo("Date" , date).orderBy("Date", Query.Direction.DESCENDING).get();
In which date is a Date object representing the date you are looking for. Remember to delete the existing data and add fresh one.

Getting issues while fetching records based on UTC date string by passing java date formatted on specific timezone

I am using bootstrap datetimepicker and using format as YYYY-MM-DDTHH:mm:ssZ the text input I am storing as it is in database column.
I have to store it as string only. While fetching records I am passing fromdate and toDate which are for applications timezone (other than client machine). We set timezone through application as well.
For MySQL query I am doing date comparison using:
str_to_date(column_name,'%Y-%m-%dT%T')
This gives an issue in fetching records. Any suggestions?
My problem is when I am not sure whether I am right about datetimepicker format.
I have to store it as string only.
Stop. Right there. There are very few reasons why you would really want to store your dates and timestamps in a MySQL database as pure text. Instead, you should be using a date column, which would alleviate your need to call STR_TO_DATE in the first place.
With regard to your call to STR_TO_DATE, I think your format mask should be this:
STR_TO_DATE(column_name, '%Y-%m-%dT%H:%i:%sZ')
This appears to be working in the demo below.
Demo

Converting date as timestamp while selecting using Hibernate APIs

We have a GUI application which sends around 40 parameters to the DB.
Based on these parameters a dynamic query is generated to fetch data. Number of fields that needs to be selected remains the same, only where condition differs.
Hibernate criteria API is used to form dynamic queries. We are using SQLMX as the database running on HP Nonstop server.
Certain dates need to be stored as 0001-01-01. Now, while selecting this field (DATE datatype), application displays this as 2001-01-01. When query is run from RazorSQL also, we are seeing incorrect results.
I could resolve this issue in RazorSQL by doing "select (cast(date1 as timestamp) from table". This gives date correctly, but with timestamp. This is OK.
In Java application, I suggested project team to use NamedNativeQueries wherein CAST as TIMESTAMP construct is specified in the query itself. Later on , I came to know that team cannot used NamedNativeQueries since queries are dynamic in nature. (Where condition can have 1 or 5 or no clauses).
Tried using Temporal.DATE annotation. Did not work. What i observed is that, we need to cast the date to timestamp while selecting itself. setMethod for the variable gets called after query has happened and if we do not do cast while doing select, value of 0001-01-01 gets changed to 2001-01-01.
Is there any way we can apply SQL constructs (similar to_date in Oracle ) before the query is executed?

Convert Date to Time

I'm having some issues with a pre-made Java master table.
The problem is that it requires to show an inserted date from my PHPMyAdmin in the form off dd-mm-yyyy-hh-mm-ss, but instead it only shows dd-mm-yyyy. Only if I edit it in the application itself it shows me the correct form.
I know some methods to format it but I could not figure out how to use these in a premade master table.
Use DateAndTime in Java and in your PhpMyAdmin have you declare a Date and Time or just Date?

Categories

Resources