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

Retrieving Field values from a Map
querystring = select <all fields> of Car__C
List<Car__c> L = Database.query(querystring);
Map<Id, Car__c> m = new Map<Id, Car__c>(L);
for (Car__c field : m.values())
{
<Car_NO> (Here it should display car no of each car.
Similaryly, any field value of each record needs to be diplayed.
}
Please help with this.
List<Car__c> L = Database.query(querystring);
Map<Id, Car__c> m = new Map<Id, Car__c>(L);
for (Car__c field : m.values())
{
<Car_NO> (Here it should display car no of each car.
Similaryly, any field value of each record needs to be diplayed.
}
Please help with this.
Can't we use the same List which is being queried ??
This would give you a similar result to map.values() in Peter's example, but since maps are unordered, Peter's list is unordered, where as the example above, using a list, is ordered.
In the map case, in addition to Peter's example, you could iterate over keySet(), and then use .get(key) to get your Car value. An example of this is below: