You need to sign in to do that
Don't have an account?
basha sk
How to filter previous values from next response values ?
Hi All,
I'm trying to filter the below mentioned response like below please check it once
Map<String,String> customsettingValues = new Map<String,String>();
Map<String,String> SelectedValues = new Map<String,String>();
Set<String> orderList1 = new Set<String>();
for(String firstKey : customsettingValues.keySet()){
String firstValue = customsettingValues.get(firstKey);
for(String secondKey : SelectedValues.keySet()){
String secondValue = SelectedValues.get(secondKey);
if(firstValue.equals(secondKey)){
orderList1.add(secondValue);
System.debug('orderList1:::---------'+orderList1);
}
}
}
I got the Response Like below for the above code
orderList1:::---------{chandra}
orderList1:::---------{chandraiii@gmail.com,chandra}
orderList1:::---------{Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{88888888888,Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
How to change above response like below
orderList1:::---------{chandra}
orderList1:::---------{chandraiii@gmail.com}
orderList1:::---------{Not Attended}
orderList1:::---------{vizag}
orderList1:::---------{ap}
orderList1:::---------{Ind}
orderList1:::---------{88888888888}
If anybody having idea please let me know
Thanks In Advance
Basha
I'm trying to filter the below mentioned response like below please check it once
Map<String,String> customsettingValues = new Map<String,String>();
Map<String,String> SelectedValues = new Map<String,String>();
Set<String> orderList1 = new Set<String>();
for(String firstKey : customsettingValues.keySet()){
String firstValue = customsettingValues.get(firstKey);
for(String secondKey : SelectedValues.keySet()){
String secondValue = SelectedValues.get(secondKey);
if(firstValue.equals(secondKey)){
orderList1.add(secondValue);
System.debug('orderList1:::---------'+orderList1);
}
}
}
I got the Response Like below for the above code
orderList1:::---------{chandra}
orderList1:::---------{chandraiii@gmail.com,chandra}
orderList1:::---------{Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{88888888888,Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
How to change above response like below
orderList1:::---------{chandra}
orderList1:::---------{chandraiii@gmail.com}
orderList1:::---------{Not Attended}
orderList1:::---------{vizag}
orderList1:::---------{ap}
orderList1:::---------{Ind}
orderList1:::---------{88888888888}
If anybody having idea please let me know
Thanks In Advance
Basha
Try below update code:
I hope this will help you.
Thanks,
Sohan Raj Gupta
All Answers
Your code is correct. You have written System.debug('orderList1:::---------'+orderList1); in FOR loop thats why you got below response in debug:
orderList1:::---------{chandra}
orderList1:::---------{chandraiii@gmail.com,chandra}
orderList1:::---------{Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
orderList1:::---------{88888888888,Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
But if you check SET collection size then it will show 7. If you want still same response which you want then you can use simple STRING instead of SET.
Please let me know if it helped or you need any more assistance.
Please mark this is as the solution if it solved your purpose.
Thank You,
Sohan Raj Gupta
Try below update code:
I hope this will help you.
Thanks,
Sohan Raj Gupta