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
Ramon PereiraRamon Pereira 

formula in Visualforce

staff,

I wish my Visualforce page was built according to the form elements. Show an accurate information block from a value of a field. I did so, but it does not work: (When passed a single parameter, it works, but as I used the formula OR, did not work)

 

<apex:pageBlockSection title="Produtos e Acessoria Técnica" columns="3" rendered="OR({!Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA'},{!Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA'} )" >

 

 

Does anyone know a way to accomplish?

 

thank you

Best Answer chosen by Admin (Salesforce Developers) 
Devendra@SFDCDevendra@SFDC

Hi,

 

Try this,

 

<apex:pageBlockSection title="Produtos e Acessoria Técnica" columns="3" rendered="{!(Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA') || (Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA')}" >

 

Thanks,

Devendra

All Answers

SanjaySSanjayS

Are you trying to vailidate the values from same sObject? You can enter this formula in the validation rules for the sObjects.

Devendra@SFDCDevendra@SFDC

Hi,

 

Try this,

 

<apex:pageBlockSection title="Produtos e Acessoria Técnica" columns="3" rendered="{!(Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA') || (Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA')}" >

 

Thanks,

Devendra

This was selected as the best answer
Rahul SharmaRahul Sharma

Rap_dev,

 

Syntax by  is perfect. Another way you use access OR function in visualforce page is as below:

<apex:pageBlockSection title="Produtos e Acessoria Técnica" 
		       columns="3" 
		       rendered="{!OR(Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA',
				      Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA'})" >

 

Raj.ax1558Raj.ax1558

Please try this -

 

<apex:pageBlockSection title="Produtos e Acessoria Técnica" columns="3"

rendered="{!if(Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA' || Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA', true, false )}" >

 

In visualforce page we can use ternary Operator -

{!if(condition, true part, false part)}

 

Note: If you satisfied with this solution please mark as solution for help other users in a same query

 

Thank You,

Raj Jha

Ramon PereiraRamon Pereira
Thank you all.