function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kush Patel 5Kush Patel 5 

Use an object's field user-input in an Apex Class

public class kushgeocode {

    public List<Account> acct {get; set;}
    public Integer radius {get; set;}
    public kushgeocode(ApexPages.StandardController controller) {
     radius = 10;                  
     acct = [SELECT 
             WHERE DISTANCE(Geocodes__c, GEOLOCATION(40.6423077,-74.5680403), 'mi') < :radius ];
I have a number field called Radius__c in my Account page. I would like to use whatever value the user inputs as my less than distance also known as "radius" in my code. So basically replace the value ten with the value of the field number given by the user in Radius__c. If anyone has a solution could you please let me know ASAP. Thanks.
deepak balur 19deepak balur 19
Comment out line 12, you have the getter/setter for radius. So, if it is an Input field it's value should come to the controller.
Kush Patel 5Kush Patel 5
If I comment out line 12, it gives me the following message: "Content cannot be displayed: Invalid distance value specified in distance expression"
That's why I need to take the value from my field number variable, Radius__c, and put it somewhere in the controller. Problem is, I don't know where to put it.