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
Lauren BLauren B 

PageBlock Title attribute based on condition

Hi,

I'd like to have the title attribute of pageblock tag based on a condition, that is something like this (not working so):
<apex:pageBlock title= "{(!IF (!ca.GROUP_ENROLL_STARTD__c = 99999999 && ca.GROUP_ENROLL_ENDD__c !=  99999999 )  'Test Types',  '')}"
So I would have the title of this pageblock to be Test Types  depending on the value of the both fields (If one field is equal to that value and another is not. Both fields are date field.
How could I do?
 
ShivankurShivankur (Salesforce Developers) 
Hi Lauren,

I guess you have missed a comma in the syntax while building the formula and could be the reason its not working, try modifying like below and check:
<apex:pageBlock title= "{(!IF (!ca.GROUP_ENROLL_STARTD__c = 99999999 && ca.GROUP_ENROLL_ENDD__c !=  99999999 ),  'Test Types',  '')}"

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.​​​​​​​
Lauren BLauren B
Hi Shivankur,
Thank you for your reply. This is the error I'm getting- Incorrect parameter type for function 'not()'. Expected Boolean, received Date. How to resolve this, please let me know. My requirement is - if start date is equal to that value and end end is not then title should be ' Test Types'. If we have to give date then how shall I give?
ShivankurShivankur (Salesforce Developers) 
Hi Lauren,

Thanks for sharing more details about the error.

Can you please let me know what is the value 99999999 being used for comparison? Can you try using a valid format instead and check?

Here are some examples with date field in the formula:
https://help.salesforce.com/articleView?id=sf.formula_examples_dates.htm&type=5

Hope above information helps. Please mark as Best Answer so that it can help others in future.

​​​​​​​Thanks.
Lauren BLauren B
Shivankur,
Thank you for your prompt reply. If I have to compare  09/09/1999 in the above code then what will be the format. Both are date fields.  
One question just asking out of my curiosity- In date field if we have to compare number then how will we do that. Thank you so much. Plese help.