User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 374,151 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,444 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 432 | Replies: 5
Reply
Join Date: Feb 2008
Posts: 26
Reputation: brr is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
brr brr is offline Offline
Light Poster

Retrieve unique items

  #1  
Apr 19th, 2008
in the below text sum the amount to those FLAG & MA_NAME fields are same and put them in one array, and unique item append to that array i did some work but difficult to get unique items

<br />
FLAG     MA_NAME                                     SUM_AMT<br />
-------- ---------------------------------------- ----------<br />
Credit   CASH                                           7777<br />
Credit   Salaries                                       9999<br />
Credit   Salaries Payable                               2222<br />
Credit   Salaries Payable                               5000<br />
Credit   State Bank of India                              22<br />
Credit   State Bank of India                            3000<br />
Credit   Sundry Debtors                                 2001<br />
Credit   Sundry Debtors                                 6666<br />
Debit    CASH                                           4444<br />
Debit    CASH                                           4999<br />
Debit    Salaries                                       3333<br />
Debit    Salaries                                       5678<br />
Debit    Salaries Payable                                 22<br />
Debit    Salaries Payable                               4567<br />
Debit    State Bank of India                            3333<br />
Debit    Sundry Debtors                                 3456<br />

in tha below code iam getting duplicate variables, how to get unique items
for(i=0;i<p;i++)
 {
	 String x=MANAME[i];
	 String y=FLAG[i];
	 int z=AMT[i];
	 for(j=i+1;j<p-1;j++)
	 {
		 String x1=MANAME[j];
		 String y1=FLAG[j];
		 int z1=AMT[j];
		 if((x.equals(x1)) && (y.equals(y1)))
		 {
			 NAME[l]=x;
			 CRDR[l]=y;
			 SUM[l]=z+z1;
			 l++;
		 }//if
		
	 }//for(j
 }//for(i
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 26
Reputation: brr is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
brr brr is offline Offline
Light Poster

Retrieve unique items

  #2  
Apr 19th, 2008
in the below text sum the amount to those FLAG & MA_NAME fields are same and put them in one array, and unique item append to that array i did some work but difficult to get unique items

[tex]
FLAG     MA_NAME                                     SUM_AMT
-------- ---------------------------------------- ----------
Credit   CASH                                           7777
Credit   Salaries                                       9999
Credit   Salaries Payable                               2222
Credit   Salaries Payable                               5000
Credit   State Bank of India                              22
Credit   State Bank of India                            3000
Credit   Sundry Debtors                                 2001
Credit   Sundry Debtors                                 6666
Debit    CASH                                           4444
Debit    CASH                                           4999
Debit    Salaries                                       3333
Debit    Salaries                                       5678
Debit    Salaries Payable                                 22
Debit    Salaries Payable                               4567
Debit    State Bank of India                            3333
Debit    Sundry Debtors                                 3456


in tha below code iam getting duplicate variables, how to get unique items
for(i=0;i<p;i++)
 {
	 String x=MANAME[i];
	 String y=FLAG[i];
	 int z=AMT[i];
	 for(j=i+1;j<p-1;j++)
	 {
		 String x1=MANAME[j];
		 String y1=FLAG[j];
		 int z1=AMT[j];
		 if((x.equals(x1)) && (y.equals(y1)))
		 {
			 NAME[l]=x;
			 CRDR[l]=y;
			 SUM[l]=z+z1;
			 l++;
		 }//if
		
	 }//for(j
 }//for(i
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,588
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 187
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Retrieve unique items

  #3  
Apr 19th, 2008
now analyse what you wrote and translate it into correct English.
When you've done that come back and try again. What you wrote there is impossible to comprehend.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Feb 2008
Posts: 26
Reputation: brr is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
brr brr is offline Offline
Light Poster

Re: Retrieve unique items

  #4  
Apr 19th, 2008
In the above i provide 3 fields with data, in that i have to get the data as
uniquely means
which are duplicate fields (flag & ma_name) aggregate as one record by sum their amt.
which are unique display as it is.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,907
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 216
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

Re: Retrieve unique items

  #5  
Apr 19th, 2008
@brr
Do not flood the forum by posting the same question more than once
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,588
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 187
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Retrieve unique items

  #6  
Apr 19th, 2008
and it still needs to learn to write proper English...
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 3:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC