You need to sign in to do that
Don't have an account?
Visualforce Tabbed Panel - display field value in Tab Label
I recently recreated my opportunity page layout using a visualforce tabbed panel. I would like to be able to display the number of related quotes on the quotes tab but I can't see to get it to work correctly. It seems like I have all the pieces so I'm not sure what I'm doing wrong. I am using the standard oppty controller with the following controller extension.
public class IntOppCon {
private Integer RelatedQuotes;
private Opportunity Opp;
public IntOppCon(ApexPages.StandardController controller) {
this.Opp= (Opportunity)controller.getRecord();
}
public Integer GetRelatedQuotes()
{
RelatedQuotes = [Select count() FROM Quote where Opportunityid = :opp.id];
return RelatedQuotes;
}
}
My visualforce page snippet works when I type is like this:
<apex:tab label="{!if(RelatedQuotes>0,"Quotes","Quotes (0)")}" name="Quotes" id="tabquote"
BUT the system starts to error out when I do it the way I would like which is like this:
<apex:tab label="{!if(RelatedQuotes>0,"Quotes (RelatedQuotes)","Quotes (0)")}" name="Quotes" id="tabquote"
OR
<apex:tab label="{!if(RelatedQuotes>0,"Quotes ({!RelatedQuotes})","Quotes (0)")}" name="Quotes" id="tabquote"
Can anyone help?
Hi Lauren!
Your problem is in that conditional if, when true you are displaying a string, whatever is between the "". The RElatedQuotes is not replaced with the value from the controller because it's considered part of the string.
Try this code:
Have a nice day! :)
Adrian
All Answers
Hi Lauren!
Your problem is in that conditional if, when true you are displaying a string, whatever is between the "". The RElatedQuotes is not replaced with the value from the controller because it's considered part of the string.
Try this code:
Have a nice day! :)
Adrian
This worked perfectly! Thank you so much!