将以下两个列表合并到Apex 或 VisionForce 中的最佳方式是什么? 数据是相互关联的, 但不能一起查询, 所以我需要将这两个列表合并起来 。
值得注意的是:
两份清单:附加的InfoFoGesesmaps是父级清单,附加的InfoFoGesesAbelableRespenses是儿童,许多儿童可能有一个。
我需要加入问题-Type_Info__c 对象上的列表 。
基本上,这是一套来自父母名单的问题,然后我需要把答案与儿童名单中的 " 是 " 和 " 是 " 和 " 否 " 等问题联系起来,这些结果将以表格的形式在VF页面上显示。
public with sharing class mytest {
public List<Questions__c> additionalInfoQuestionMaps {get;set;}
public List<Available_Question_Answer_Options__c> additionalInfoQuestionAvailableResponses {get;set;}
public List<retrieveMergedQuestionList> retrieveMergedQuestionLists {get;set;}
public String buildId {get;set;}
public Build__c build {get;set;}
public mytest() {
buildId = a1DV00000001BBBBBB ;
build = sharedfile.getBuild(buildId);
updateAdditionalInfoQuestionMaps();
updateAdditionalInfoFieldValueIds();
updateAdditionalInfoQuestionAvailableResponses();
}
public void updateAdditionalInfoQuestionMaps() {
additionalInfoQuestionMaps = new List<Questions__c>([SELECT Id, Name,
Associated_Product_Item__c,
Associated_Product__c,
Label__c,
(select Response__c from Responses_Object__r),
Question_Type_Info__c,
Required__c
FROM Questions__c
WHERE Associated_Product__c = :build.Associated_Product__c
ORDER BY Sort_Index__c, Label__c]);
}
public Set<Id> additionalInfoFieldValueIds = new Set<Id>();
public void updateAdditionalInfoFieldValueIds(){
for (Questions__c aimb : additionalInfoQuestionMaps) {
additionalInfoFieldValueIds.add(aimb.Question_Type_Info__c);
}
}
public void updateAdditionalInfoQuestionAvailableResponses() {
additionalInfoQuestionAvailableResponses = new List<Available_Question_Answer_Options__c>([select Id,
Field_Value__c, Question_Type_Info__c
from Available_Question_Answer_Options__c
where Question_Type_Info__c IN :additionalInfoFieldValueIds]);
}
}