File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need to find category

 
pankaj semwal
Ranch Hand
Posts: 303
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi ,

I am getting the category like .Sr Prgorammer,Ass.Programmer and Programmer like etc
But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code
Please help me.
Thanks


 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:

But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code


I don't get your question, Do you want to count How many times "Sr.Progrmmer ,Ass.Prormmer", category occurred in a given result set, Then just get the counter for each of category and increment it when you found that category
 
Muhammad Ijaz
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what Sagar Rohankar is saying is the right solution. But If your concern is to get a sql statement that will also count the categories, you will have to build your sql statement with group by clause counting the categories
 
pankaj semwal
Ranch Hand
Posts: 303
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.But using java code.

 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:yes.But using java code.


Then whats the problem in adding counter and incrementing in the same code?, like

 
pankaj semwal
Ranch Hand
Posts: 303
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

after that i have to calculate the total salary of each category
i.e
srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary)*srProgrammerCounter;
srProgrammerSal=jobSalary+jobSalary*unit/100;


will this return the exact answer.
 
Muhammad Ijaz
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can calculate as follows:

srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary*srProgrammerCounter);
srProgrammerSal=jobSalary+jobSalary*unit/100;
srProgrammerSal = srProgrammerSal*srProgrammerCounter;





Hope it will help

Pomy
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad Ijaz wrote:
srProgrammerSal = srProgrammerSal*srProgrammerCounter;

srProgrammerSal *= srProgrammerCounter;
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic