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
Sindhu AmbarkarSindhu Ambarkar 

wrapper class issue

Hi,

Iam facing issue in wrapper class
Custom object:Doctor__c,Patient__c is having lookup to Doctor__c

Controller

public class doctor
{
public List<Doctor__c> d{get;set;}
public List<Patient__c> l{get;set;}
public set<string> member=new set<string>();
public List<selectwrapper> li{get;set;}
PUBLIC map<string,Doctor__c> dm=new map<string,Doctor__c>();
public map<string,Patient__c> tm=new map<string,Patient__c>();
public doctor()
{
li=new List<selectwrapper>();
d=[select name,Type__c from Doctor__c];
if(d.size()>0)
{
For(Doctor__c Ls:d)
{
member.add(Ls.Name);
dm.put(Ls.Name,ls);
}
}
l=[select Name,DoctorSpec__c from Patient__c where DoctorSpec__c IN:member];
if(l.size()>0)
{
for(Patient__c pl:l)
{
if(!tm.containskey(pl.DoctorSpec__c))
{
tm.put(pl.DoctorSpec__c,pl);
}
}
for(String i:tm.keyset())
{
li.add(new selectwrapper(dm.get(i),tm.get(i)));
}
}
system.debug('list'+li);
}
public  class selectwrapper
{
public Doctor__c dt{get;set;}
public Patient__c td{get;set;}
public selectwrapper(Doctor__c dt,Patient__c td)
{
this.dt=dt;
this.td=td;
}
}
}

page

<apex:page controller="doctor">
<apex:form >
<apex:pageblock >
<apex:pageblocktable value="{!li}" var="c">
<apex:column value="{!c.dt.Name}"/>
<apex:column value="{!c.dt.Type__c}"/>
<apex:column>
<apex:pageblocktable value="{!c.td}"  var="l">
<apex:column value="{!l.Name}"/>
</apex:Pageblocktable>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
Facing issue in the page

Please help me out
Ankit SehgalAnkit Sehgal
<apex:page controller="doctor">
<apex:form >
    <apex:pageblock >
        <apex:pageblocktable value="{!li}" var="c">
            <apex:column value="{!c.dt.Name}"/>
            <apex:column value="{!c.dt.Type__c}"/>
            <apex:column >
                <apex:pageblocktable value="{!c.td}"  var="la">
                    <apex:column value="{!la.Name}"/>
                </apex:Pageblocktable>
            </apex:column>
        </apex:pageblocktable>
    </apex:pageblock>
</apex:form>
</apex:page>

here's your solution
Sindhu AmbarkarSindhu Ambarkar
Its not working there is  a problem in the controller.Please provide the soultion.

Thanks & Regards,
Sindhu Ambarkar.
Ankit SehgalAnkit Sehgal
The issue is occuring most probably because you are using same name for the patient type list "l" and var variable in pageblocktable which is also "l". try changing the variable name in controller to some unique name
Sindhu AmbarkarSindhu Ambarkar
Its showing as blank pag.Nothing is working out.

Thanks & Regards,
Sindhu Ambarkar.
Ankit SehgalAnkit Sehgal
Insert some records in patient and doctor object