You need to sign in to do that
Don't have an account?
shephali
Object to string conversion??
Hello friends,
Here is my code.where i first fetch the max value and using that max value trying to fetch one row.but unable to do so because it needs object to string conversion.
[i tried--->> String s=code.toString(); //not working.]
AggregateResult[] groupedResults=[select MAX(Agent_ID__c)maxvalue from Mobile_Agent__c];
Code = groupedResults[0].get('maxvalue');
TableData=[select Name,Last_Name__c,Device_Phone__c,Subscriber_ID__c,Agent_ID__c,registered_date__c from Mobile_Agent__c where Agent_ID__c='Code'];
Here is my code.where i first fetch the max value and using that max value trying to fetch one row.but unable to do so because it needs object to string conversion.
[i tried--->> String s=code.toString(); //not working.]
AggregateResult[] groupedResults=[select MAX(Agent_ID__c)maxvalue from Mobile_Agent__c];
Code = groupedResults[0].get('maxvalue');
TableData=[select Name,Last_Name__c,Device_Phone__c,Subscriber_ID__c,Agent_ID__c,registered_date__c from Mobile_Agent__c where Agent_ID__c='Code'];
You can use String.valueof() as shown below
Code = String.valueof(groupedResults[0].get('maxvalue'));
Hope it helps!
TableData=[select Name,Last_Name__c,Device_Phone__c,Subscriber_ID__c,Agent_ID__c,registered_date__c from Mobile_Agent__c where Agent_ID__c=:Code];