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
Malik ButlerMalik Butler 

I'm trying to create a visualforce page and turun that into a list button on my opportunity product, but I am stuck on how to formulate the standard controller.

<apex:page controller="Calculator"> <apex:form > <apex:inputText value="{!number1}"/> <apex:inputText value="{!number2}"/> <apex:inputText value="{!operator}"/> <apex:commandButton value="Show Result" action="{!calculation}">{!result} </apex:commandbutton> </apex:form> </apex:page>


CONTROLLER

public class Calculator
{
public integer number1{get;set;}
public integer number2{get;set;}
public string operator{get;set;}
public double result{get;set;}
public void calculation()
{
if(operator.contains('+'))
result=number1+number2;
if(operator.contains('-'))
result=number1-number2;
if(operator.contains('*'))
result=number1*number2;
if(operator.contains('/'))
result=number1/number2;
}
}
 
Malik ButlerMalik Butler
This is to create a sum of time it takes to install a job. I have made a custom field Typical_time_to_install__c which is related to an opportunity product. I just want to add all of the times of each product and get the sum Total_time_to_install.
Malik ButlerMalik Butler
This is also supposed to be made as simple as possible
Naval Sharma4Naval Sharma4
Have a look at the following article. I hope it will give you an idea.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm
Naval Sharma4Naval Sharma4