You need to sign in to do that
Don't have an account?
DennoP
Is there any way to link tables in an SOQL to display in a datatable
I have two objects, appointment__c and contact. appointment__c has a field called who__c which is a contact id.
Is there any way to link the two tables in an SOQL so that I can use the output in a datatable? as I want to show the contact name against the appointment instead of the contact id which is who__c. i.e. {!eVisit.cont.name} in my page layout.
I have been using the following SQL which works OK until I try and add a second table to view the contact name and I get the error message "Compile Error: unexpected token: cont.id at line 24 column 33".
public List<Appointment__c> getVisits(){
Visits = [SELECT app.id, cont.name, app.Name, app.Assigned_To__c, app.Who__c, app.Time_Band__c, app.Visit_Date__c, app.Visit_Type__c
FROM Appointment__c app, Contact cont
WHERE app.Status__c = 'Appointed'
AND app.who__c = cont.id
AND app.Visit_Date__c > :tmp
AND app.Assigned_To__c = :ApexPages.currentPage().getParameters().get('id')
Order by app.Visit_Date__c
limit 200];
return Visits;
}
Is there any way to link the two tables in an SOQL so that I can use the output in a datatable? as I want to show the contact name against the appointment instead of the contact id which is who__c. i.e. {!eVisit.cont.name} in my page layout.
I have been using the following SQL which works OK until I try and add a second table to view the contact name and I get the error message "Compile Error: unexpected token: cont.id at line 24 column 33".
public List<Appointment__c> getVisits(){
Visits = [SELECT app.id, cont.name, app.Name, app.Assigned_To__c, app.Who__c, app.Time_Band__c, app.Visit_Date__c, app.Visit_Type__c
FROM Appointment__c app, Contact cont
WHERE app.Status__c = 'Appointed'
AND app.who__c = cont.id
AND app.Visit_Date__c > :tmp
AND app.Assigned_To__c = :ApexPages.currentPage().getParameters().get('id')
Order by app.Visit_Date__c
limit 200];
return Visits;
}
Superfell
select name, who__r.name from appointment__c where assigned_To__c = ....