+ Start a Discussion
HaralambyHaralamby 

Declare a variable and if statement.....help please!!

Hello!
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!!!!!!!!!
SFDCRRSFDCRR
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 
HaralambyHaralamby

If there is an easier way I would take it but the code was written to amortize pipeline revenue daily....so 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 daily......now 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!!!!!