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

Declare a variable and if please!!

I am new at writing APEX code and I need some help.   I want to write the following Excel logic in APEX CODE:

My organization has three products….let's call them "Product 1" , "Product 2", and "Product 3"

For Each Product I have a field called "Product 1 Rate", "Product 2 Rate" and "Product 3 Rate"

I want to declare a variable called "PriceDaily" and have it equal one of the product rates.

So I want to say:  If Product name is  "Product 1" than "Price Daily" is "Product 1 Rate",
                                    If Product name is  "Product 2" than "Price Daily" is "Product 2 Rate",
                                    If Product name is  "Product 3" than "Price Daily" is "Product 3 Rate"

How is this written in an APEX Class? 

Thank you for you help!!!!!!!!!
U can do this in any in the product section , do u want a new page with all this for that u do not hv to write apex.   so let me know wht u really want apex code ? or the easy way 

If there is an easier way I would take it but the code was written to amortize pipeline revenue when someone wants to update the revenue schedule of these opportunities all they have to do is press a button.....this button updates the start date because these are pipeline opportunites and their start date is not confirmed...hence changing all I want to do is edit the code (as indicated earlier) that is already written without being charged an arm and a leg.


If you know of a way that is easier please share....I would love to be APEX free....but I was told that's not possible for this iniative........thanks!!!!!