I have a custom object related to Account via look up relationship. For each of the custom object records I would like to display the related AccountHistory.
In theory, I would ideally like to pull 2 lists, Custom Record list and Account history list and then display the records as nested pageblocktable.
Since these 2 objects are not exactly related I am wondering if this is even possible in visual force?
Update
public Class Engagement {
public Engagement__c[] getDelta(){
List<Engagement__c> x = [SELECT Name, ID,CreatedDate,Account_ID__c,Delta__c,Account_Name__c,
FROM Engagement__c
WHERE (CreatedDate2EqualsToday_1__c = TRUE)
ORDER BY Account_ID__c,CreatedDate ASC];
if(!x.isEmpty())
{
for(Integer i=1; i<x.size();i++)
{
if(x[i].Account_ID__c == x[i-1].Account_ID__c)
{
x[i].Delta__c = x[i].Engagement_Score__c-x[i-1].Engagement_Score__c;
i++;
}
else system.debug('nothing found');
}
}
return x;
}
Map<id,AccountHistory> mapAccountHistory = new Map<id,AccountHistory>();
}
I need to Link result from getDelta() to AccountHistory by using the Account ID field that exists in Engagement__c. I have never used MAPs before so I am really struggling here.