+ Start a Discussion
❤Code❤Code 

SOQL returning zero rows on action:support call

Hi All,

I have a vf page where i am dynamically adding rows. I am using wrapper class to add empty rows evrytime. After selecting custom package values from selectlist , action:support is fired which in turn calling getMarket() method. This is currently is a single picklist and it is not displaying any values. At backned there is data. Please help where things has gone wrong. Is vf page binding incorreclty done..

Alex Class - 

public with sharing class RFPController{

    public RFP__c accounts;
        public Custom_Package__c del;
        public List < Custom_Package__c > addattendeeList {get;set;}
        public List < Custom_Package__c > delattendeeList {get;set;}
        public List < Custom_Package__c > attendeeList {get;set;}
        public Integer totalCount {get;set;}
        
        public Integer rowIndex {get;set;}
        public Integer deleterowIndex {get;set;}
        public List < Custom_Package__c > delAttendees {get;set;}
        public Boolean isRerender{get;set;}
        //public String S {get;set;}
         public Integer numberOfRowToRemove { get; set; }
         public String selectedRowIndex{get;set;} 
        //public Integer count = 1;
         public Integer c{get; set;} 
         //public Integer counter{get;set;}
         private List<SelectOption> options;
         public List<SelectOption> AllName{get;set;}
         public List<SelectOption> AllDept{get;set;}
        // public String discountScheduleID { get; set; }
        public  string mark {get; set;}
        
        Public List<CustomPackageWrapper> cplist = new List<CustomPackageWrapper>();
        public CustomPackageWrapper cp = new CustomPackageWrapper (new Custom_Package__c() ); 
        
        private List<Custom_Package__c>  acc {get;set;}
        
        public RFPController(ApexPages.StandardController controller) {

                isRerender = false;
                accounts =  (RFP__c )controller.getRecord();
                String S = 'Select id, Name, Market__c, State__c, First_Issue__c,Last_Issue__c,Circulation__c,Space_Unit__c,Per_Unit_Open_Rate__c,Space_Discount__c from Custom_Package__c ';
                //totalCount = attendeeList.size();
                attendeeList  = Database.Query(S);
                attendeeList = new List < Custom_Package__c >();
          
                delattendeeList = new List < Custom_Package__c > ();
                delattendees = new List < Custom_Package__c > ();
               
                accounts.Rep_Name__c= Userinfo.getuserId();
                c=0;
               // AllName = getMarket();
                Alldept = getDept();
                attendeeList1 = new List<CustomPackageWrapper>();
        }
 
        public void addRow() {
                isRerender = true;
               
               CustomPackageWrapper cw = new CustomPackageWrapper(new Custom_Package__c());
               
               attendeeList1.add(cw);


        }

        

    public List<ID> discountScheduleID {
        get {
            if (discountScheduleID == null) {
                discountScheduleID = new List<ID>();
            }
            return discountScheduleID ;
        }
        set;
    }
    
      public List<SelectOption> getDept()
    {
        List<SelectOption> options = new List<SelectOption>();
        //options.add(new SelectOption('Select','--Select--'));
        
        for(Custom_Package__c Proj  :[select Id, Name from Custom_Package__c ] )
             {
                    system.debug('3333333'); 
                    options.add(new SelectOption(Proj.ID,Proj.Name));
                    
             }
        return options;
        
    }
 
   
   public Integer selectedRowIdx {get; set;}

    
    public List<SelectOption> getMarket(){
        system.debug('^^^^^^^^ Entered' +cp.discountSchedule );
            List<SelectOption> options = new List<SelectOption>();
            //cp.discountSchedule = new List<ID>();
            
         for(Custom_Package__c Proj1  :[select Id,Market__c from Custom_Package__c where ID IN:cp.discountSchedule] )
                {                    
                    system.debug('3333333' + cp.discountSchedule ); 
                   // CustomPackageWrapper cp = new CustomPackageWrapper (new Custom_Package__c());
                   //  cp.discountSchedule.add(Proj1.Market__c );
                   //  cplist.add(cp );
                    options.add(new SelectOption(Proj1.ID,Proj1.Market__c ));
                    
                }
              
        system.debug('^^^^^^^^ Entered' + options.size());        
        return options;
        

    }
    
    public string selectedMarketIds {get; set;}  
    
        public void FindAllName()
    {
        AllName= new List<SelectOption>();
        AllDept= new List<SelectOption>();
        system.debug('!!!!!!! Entered');
        AllName = getMarket();
        Alldept = getDept();
        system.debug('&&&&&&& Entered' + AllName );

    }
    
    public List<CustomPackageWrapper> attendeeList1 {
        get {if (attendeeList1 == null)
             attendeeList1 = new List<CustomPackageWrapper>();
             return attendeeList1;
       }
        set;
        }



        public class CustomPackageWrapper {
        public Custom_Package__c cp {get; set;}
        //public List<ID> discountSchedule {get; set;}
        //public String discountSchedule1 {get; set;}
        public Integer rowIndex {get;set;}
        
        public List<ID> discountSchedule {
        get {
            if (discountSchedule == null) {
                discountSchedule = new List<ID>();
            }
            return discountSchedule ;
        }
        set;
        }
        
        public List<String> discountSchedule1 {
        get {
            if (discountSchedule1 == null) {
                discountSchedule1 = new List<String> ();
            }
            return discountSchedule1 ;
        }
        set;
        }
        
        public CustomPackageWrapper(Custom_Package__c cp) {
        
        
        this.cp = cp;
        
        
        }
        
       
        }

  
}



VF Page - 

<apex:page standardController="RFP__c" extensions="RFPController" sidebar="false">

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <c:FixSfdcFocusHack />
    <c:JQuery />
    <c:Chosen />
    <style type="text/css">
        .fullWidth { width: 100%; }
        .flightDateRangeText { font-size: 90%;  }
        
        .bPageBlock .requiredForSubmit .requiredBlock {
        background-color: #FFD700;
        bottom: 1px;
        left: -4px;
        position: absolute;
        top: 1px;
        width: 3px;
        }
        
        .bPageBlock .requiredForSubmitInput {
        height: 100%;
        position: relative;
        }
        
    </style>
    <script type="text/javascript">
    /* <![CDATA[ */
    
    /* 
         *  Render Chosen on select elements with the chzn-select class specified.
         */
         
    function renderChosen() {
   
            $j('.chzn-select').chosen();
            
    } 
    
    function focusChosen() {
        $j('.search-field').find("input").focus();       
    }       
    
    /*
         *  Render required marker on elements where class == "required".
         */
    function renderRequired() {
        $j('.required').wrap('<div class="requiredInput" />').before('<div class="requiredBlock" />');
    }
    
    /*
         *  Render required marker on elements with the specified ID.
         */        
    function renderRequiredComponentId(componentId) {
        $j(jq(componentId) + ' .required').wrap('<div class="requiredInput" />').before('<div class="requiredBlock" />');
    }
    
    var rfpRequiredIds = ["dueDate", "clientsEstablishedPartners", "campaignMarketingObjectives", "campaignGoals",
                          "scopeOfCampaign", "mediaRequested", "otherMediaRequested", "campaignTotalNet", 
                          "primaryTargetAudience", "geographies", "servingPreference", "clientServedSpecifics", "adSizes",
                          "creativeType", "richMediaType", "percentageFlash", "percentageRichMedia", "flightDateRanges"];
    
    var optRequiredFieldIds = ["planCompletionDate", "clientsEstablishedPartners",
                               "campaignMarketingObjectives", "campaignGoals", "scopeOfCampaign", "mediaRequested", "campaignComments",
                               "primaryTargetAudience", "geographies", "customGeoDetail", "servingPreference", "clientServedSpecifics",
                               "adSizes", "creativeType", "richMediaType", "additionalCreativeNotes"];
    
    //SSirikonda - 07/25/2013 - Removing the field Plan_completion_Date__c as yellow marked field when
    //RFP type drop-down = SEM   
    /*var semRequiredFieldIds = ["planCompletionDate", "url", 
           "campaignMarketingObjectives", "campaignComments", "geographies", "customGeoDetail"];*/
    
    var semRequiredFieldIds = ["url", 
                               "campaignMarketingObjectives", "campaignComments", "geographies", "customGeoDetail"];
    
    function modifyRequired() {
        $j('.requiredForSubmitInput').removeClass('requiredForSubmitInput');
        var type = $j('[id$="type"]').val();
        if (type == 'RFP') {
            $j.each(rfpRequiredIds, function(index, value) {
                var selector = '[id$="' + value + '"]';
                $j(selector).addClass('requiredForSubmitInput');
            });
        } else if (type == 'OPT') {
            $j.each(optRequiredFieldIds, function(index, value) {
                var selector = '[id$="' + value + '"]';
                $j(selector).addClass('requiredForSubmitInput');
            });
        } else if (type == 'SEM') {
            $j.each(semRequiredFieldIds, function(index, value) {
                var selector = '[id$="' + value + '"]';
                $j(selector).addClass('requiredForSubmitInput');
            });
        }
    }
    
    function changePrimaryContact() {
        var value = $j('[id$="primaryContact"]').val();
        var selector = '[id$="agencyContact"]';
        $j(selector).removeClass('requiredInput');
        var selector = '[id$="agency"]';
        $j(selector).removeClass('requiredInput');
        if (value == 'Agency') {
            var selector = '[id$="agency"]';
            $j(selector).addClass('requiredInput');
            var selector = '[id$="agencyContact"]';
            $j(selector).addClass('requiredInput');
        }
    }
    
    $j(document).ready(function() {
        renderChosen();
        renderRequired();
        clearErrors();
        changePrimaryContact();
        modifyRequired();
    });
    
    /* ]]> */        
    </script>
    <style>
   .twitterStyleTextbox {
    border: 1px solid #c4c4c4;
    width: 180px;
    height: 18px;
    font-size: 13px;
    padding: 4px 4px 4px 4px;
    border-radius: 4px;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    box-shadow: 0px 0px 8px #d9d9d9;
    -moz-box-shadow: 0px 0px 8px #d9d9d9;
    -webkit-box-shadow: 0px 0px 8px #d9d9d9;
}

.twitterStyleTextbox:focus {
    outline: none;
    border: 1px solid #7bc1f7;
    box-shadow: 0px 0px 8px #7bc1f7;
    -moz-box-shadow: 0px 0px 8px #7bc1f7;
    -webkit-box-shadow: 0px 0px 8px #7bc1f7;
}
 </style>
    

<apex:form id="myForm">
<apex:pageBlock id="pb">
        <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!Cancel}" value="Cancel"/>
         </apex:pageBlockButtons>

<apex:pageMessages />
      <apex:outputText rendered="{!isRerender}">

      </apex:outputText>      
      <apex:variable var="rowNumber" value="{!0}"/>
      
     
      <apex:pageBlockSection title="Child RFP Details" collapsible="false" id="section">
      
        <apex:pageBlockTable id="thetable"  var="acc" value="{!attendeeList1}" onRowMouseOver="removeHighlight(this)">
        
             <apex:column headerValue="Action" >
            <apex:commandLink value="Copy" reRender="pb" onclick="testMe(event)"/>
          </apex:column>
          
          <apex:column headerValue="Custom Package">
                 <apex:param name="rowIndex" value="{!rowNumber}"/>
                         <apex:selectList multiselect="true" value="{!acc.discountSchedule}"  styleClass="fullWidth chzn-select" size="1" style="width:400px;" >
                          <apex:actionSupport event="onchange" action="{!FindAllName}" rerender="geographies"  oncomplete="renderChosen()"/>
                        <apex:selectOptions value="{!Dept}"/>
                      </apex:selectList> 
                <apex:variable var="rowNumber" value="{!rowNumber+1}"/> 
          </apex:column>
           

          <apex:column headerValue="Market" id="market">
            <apex:outputPanel id="geographies" layout="block" >
          <apex:selectList id="selectedmarkets" multiselect="false" value="{!acc.discountSchedule1}"  styleClass="fullWidth chzn-select" size="1" style="width:150px" >
                
              <apex:selectOptions value="{!Market}"/>
             </apex:selectList> 
            </apex:outputPanel>
          </apex:column>
          
          <apex:column headerValue="State" >
            <apex:inputField value="{!acc.cp.State__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>
          <apex:column headerValue="First Issue" >
            <apex:inputField value="{!acc.cp.First_Issue__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>
          <apex:column headerValue="Last Issue" >
            <apex:inputField value="{!acc.cp.Last_Issue__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>
          <apex:column headerValue="Circulation" >
            <apex:inputField value="{!acc.cp.Circulation__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>
            <apex:column headerValue="Space Unit">
            <apex:inputField value="{!acc.cp.Space_Unit__c }" styleClass="chzn-select"/>
          </apex:column>
          <apex:column headerValue="Space Discount">
          <apex:inputField value="{!acc.cp.Space_Discount__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>
           <apex:column headerValue="Per Unit Open Rate">
          <apex:inputField value="{!acc.cp.Per_Unit_Open_Rate__c}" styleClass="twitterStyleTextbox"/>
          </apex:column>

        </apex:pageBlockTable>

      </apex:pageBlockSection>
      <apex:commandButton action="{!addRow}" value="Add Row" reRender="pb" oncomplete="renderChosen()"> 
      <apex:param name="rowIndex" value="{!rowNumber}"/>
      
       </apex:commandButton>
            
</apex:pageblock>
</apex:form>
</apex:page>

​Regards
pconpcon
When you run this, does the system.debug('^^^^^^^^ Entered' +cp.discountSchedule ); print any discountSchedule ids?  To be honest this is a lot of code to try to debug without any institutional knowledge.

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
❤Code❤Code
No its not printing at the given line..
pconpcon
So the discountSchedule is empty when it reaches there, or the debug line isn't printing at all?