You need to sign in to do that
Don't have an account?

How to get the value for an field from the keySet(). I don't want the value for all fields but value for some fields in the object. And I have to store the selected key and value to another map
Hi
How to get the value for an field from the keySet().
I don't want the value for all fields but value for some fields in the object.
And I have to store the selected key and value to another map
How to get the value for an field from the keySet().
I don't want the value for all fields but value for some fields in the object.
And I have to store the selected key and value to another map
Code:
for (String key : someMap.keySet()) {
PUT YOUR LOGIC HERE using:(key + " = " + someMap.get(key));
}
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thx
Thank You for the help.
I have to get the values of the fields.
And have to store it in a new map.
Could u plz write how to construct a new map.
And add the key and value to the new map.
Regards,
Nisha
Below is the things which u can do with maps which may help you.
Map<Integer, String> m = new Map<Integer, String>(); // Define a new map
m.put(1, 'First entry'); // Insert a new key-value pair in the map
m.put(2, 'Second entry'); // Insert a new key-value pair in the map
System.assert(m.containsKey(1)); // Assert that the map contains a key
String value = m.get(2); // Retrieve a value, given a particular key
System.assertEquals('Second entry', value);
Set<Integer> s = m.keySet(); // Return a set that contains all of the keys in the map
If this solves your problem please mark it as solution(Best Answer)
Thanks
Sandhya Reddy