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
prasanth kumarprasanth kumar 

Error: Incorrect parameter type for function 'CONTAINS()'. Expected Text, received Object in visualforce page rendered

hi, i am trying to rendered (hide) the pageblocktable which is nested pageblocktable.  


Error: Incorrect parameter type for function 'CONTAINS()'. Expected Text, received Object     in visualforce page rendered
<apex:page CONTROLLER="DYNAMICAPPROVALCLASS">
<apex:form >
<apex:pageblock title="cust with trans">
<apex:pageblocktable value="{!cus}" var="a">
<apex:column value="{!a.id}" />
<apex:column value="{!a.name}" />

<apex:column >  
<apex:pageblocktable value="{!a.transactions__r}" var="t">
<apex:column value="{!t.Amount__c}" />
<apex:column value="{!t.Transaction_Type__c}" />


<apex:column >  
<apex:pageblocktable  rendered="{!IF(CONTAINS(m3,t.id),true,false)}"  value="{!m3[t.id]}" var="p"  >
<apex:column value="{!p.status}"  />
</apex:pageblocktable>
</apex:column>

</apex:pageblocktable>

</apex:column>
</apex:pageblocktable>
</apex:pageblock>


<apex:pageblock title="All Transactions List">
<apex:pageblocktable value="{!trans}" var="a">
<apex:column value="{!a.Amount__c }" />
<apex:column value="{!a.Name }" />
<apex:column value="{!a.Transaction_Type__c}" />
<apex:column >
<apex:repeat value="{!a.processinstances}" var="p">
{!p.status} ................... {!p.SubmittedById}
</apex:repeat>
 </apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>

controller:-
 
public class DYNAMICAPPROVALCLASS {

public list<transaction__c> trans{set;get;}
public list<customer__c> cus{set;get;}
public list<ProcessInstance> p1 {set;get;}
public map<id,list<string>> m1{Set;get;}
public map<id, ProcessInstance> m3{set;get;}
public map<string,account> m2{set;get;}
public  DYNAMICAPPROVALCLASS()
{
account acc=new account(name='tesing 123');
m3=new map<id, ProcessInstance>();
trans=[SELECT Amount__c,Name,Transaction_Type__c,(SELECT Status,SubmittedById,SystemModstamp,TargetObjectId FROM ProcessInstances) FROM transaction__c];

cus=[select id,name,(select id, amount__c,name,Transaction_Type__c from transactions__r where name='18') from customer__c];

set<id> ids=new set<id>();
for(customer__c c1:cus)
{
for(transaction__c t1:c1.transactions__r)
{
ids.add(t1.id); } }
// p1=[select id,status,SubmittedById from ProcessInstance where TargetObjectId in:ids];
// m1=new map<id ,list<string>>();
 
 
 
 for(ProcessInstance pp:[select id,status,SubmittedById,TargetObjectId from ProcessInstance where TargetObjectId in:ids])
     {
       m3.put(pp.targetobjectid, pp);  
    
       }
 
}
}

 
pconpcon
The problem is that m3 is a map of ids to ProcessInstance objects and CONTAINS does not apply to maps it is only for strings.  What I would suggest is that you iterate over all your possible Ids and if they do not exist in your m3 map then put a new instance (or a null value) into your map and then check that the get of the Id does not equal null.