English 中文(简体)
如何将数据从 Apex 或 VisionForce (Selforce) 中的两个列表中合并?
原标题:How to merge data from two lists in Apex or VisualForce (Salesforce)?

将以下两个列表合并到Apex 或 VisionForce 中的最佳方式是什么? 数据是相互关联的, 但不能一起查询, 所以我需要将这两个列表合并起来 。

值得注意的是:

  1. 两份清单:附加的InfoFoGesesmaps是父级清单,附加的InfoFoGesesAbelableRespenses是儿童,许多儿童可能有一个。

  2. 我需要加入问题-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]);

    }           

}
问题回答

我想你应该去参加一个包装纸类, 如果我正确理解你的问题

看看我先前曾问过的一个类似问题,

< a href=> https://stackoverflow.com/ questions/890012/how-to-create-sections- of-grouped-data-in-vf-page> 如何在 Vf page 中创建分组数据的章节?

希望这能帮上忙

谢谢 谢谢





相关问题
Salesforce - Populate text are from drop down selection

I have a picklist with three values and a text area that has three values as well, but I would like to correlate one value from the picklist with one value of the text area. Any thoughts as on how I ...

Setting Timeout value for Salesforce Web Service/API

The API for Salesforce is a web service, you set it up by downloading a WSDL file from Salesforce and adding the WSDL to your .NET project. But I can t find anywhere to set the Timeout value. ...

Salesforce Custom Objects

Hi I am trying to create a Custom Object in Salesforce.com Developer Edition, because I would then like to use this Custom Object in a New Custom Tab say "Properties". Properties tab will contain ...

热门标签