on 09-09-2014 8:36 AM
Hi Gurus,
Please tell me the code in web dynpro java to display data according to fiscal year (April to March).
hi,
i have tried the code given by Vijay Kumar Kalluri and you. none is working. i want the data to be displayed on the basis of month and year.
for example: if user selects March 2014, the data should be displayed from March 2013 to December 2014 and January 2014 to March 2014.
What will be the code for that? I am using SQL query to fetch data from database on web dynpro java.
thanks & regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Shilpi Mahajan,
I am asking one Question...
Did you check the SQL query? is it working above SQL query example in your SQL DB?
I mean in your SQL query whenever you gave the input as March 2014, then you will get the data March 2013 to December 2014 and January 2014 to March 2014.
Regards
Vijay Kalluri
HI all,
thanks for your instant answers. here the data is in the form of months and year, in two different columns. i tried the code which you have given me it is not taking that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you have a specific question, please ask it here - however if you are looking for someone to supply a complete code solution for your work then that isn't what SCN is for. Please think about just what you want and post back again.
Cheers,
G.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi shilpi mahajan,
you can use the below code that is prepared statement is always preffered, because it saves time in processing data base query.
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date startDate = formatter.parse(sdate);
java.util.Date endDate = formatter.parse(edate);
PreparedStatement pstmt = connection.prepareStatement("SELECT sales.InvoiceNumber, sales.ShipToAddress, sales.Date "
+ "FROM sales, customers "
+ "WHERE sales.CardRecordID = customers.CardRecordID "
+ "AND customers.Name = 'Cash Sales' "
+ "AND sales.Date BETWEEN ? AND ? "
+ "ORDER BY sales.ShipToAddress ASC, sales.Date DESC");
pstmt.setDate(1, new java.sql.Date(startDate.getTime()))
pstmt.setDate(2, new java.sql.Date(endDate.getTime()))
Calendar cal = Calendar.getInstance();
cal.add(Calendar.YEAR,-1);
Date startDate= new Date(cal.getTimeInMillis());
Date endDate = new Date(System.currentTimeInMillis());
here Date highlighted in bold is of type java.sql.date and start date is one year before the current date .
Regards
Govardan Raj S
I don't think that anyone can help you with that because no one can even imagine what you are trying to do and where exactly the problem is... So maybe tell us some more?
Regards
Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.