• Laxmi Pandey 20
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 11
    Replies
Hi ,
I have got a requirement to convert the below Java code in Apex. This is to flatten multivalue for row level security. Any suggestion/help will be appreciated. Thanks.


public class MultiValueFileUtils {
    private static final String FILE_DIR= "src/main/resources/";

    private static final String DELIM=",";
    private static final String MV_DELIM="|";
    
    public static void main(String[] aArgs){

        try{

        //    createHashSet();
        //    printOutFlatten();
        //    printFlattenFile();
            printNormalizedFile();

        }catch(Exception e){
            e.printStackTrace();
        }
        
    }
    
        
  private static void createHashSet(){
      
      HashSet<String>  userIds = new HashSet<String>();
      userIds.add("ABC");
      userIds.add("DEF");
      userIds.add("GHI");
      
      Map<String, HashSet<String>> territoryMap = new HashMap<String, HashSet<String>>();
      territoryMap.put("TER1", userIds);
      
      HashSet<String>  moreuserIds = new HashSet<String>();
      moreuserIds.add("ABC");
      moreuserIds.add("DDD");
      moreuserIds.add("HHH");
      
      territoryMap.get("TER1").addAll(moreuserIds);
      
      HashSet<String> completeList =territoryMap.get("TER1");
      
      for (String s : completeList) {
            System.out.println(s);
        }
      
  }
  
  private static Map<String,HashSet<String>>  joinMVtoHiearchy(String aHiearchyFile, String aMultiValueFile ){
      Map<String,HashSet<String>> hiearchyMap=flattenHiearchy(aHiearchyFile);
      Map<String,HashSet<String>> keyMVMap=flattenField(aMultiValueFile);
      Map<String,HashSet<String>> hiearchyMVMap =new HashMap <String,HashSet<String>>();
       for (Map.Entry<String, HashSet<String>> entry : hiearchyMap.entrySet()) {
               HashSet<String> hiearchySet =entry.getValue();
               HashSet<String> completeMVSet = new HashSet<String>();
               for (String s : hiearchySet) {
                   
                   HashSet<String> partMVSet =keyMVMap.get(s);
                   if(partMVSet!=null){
                   completeMVSet.addAll(partMVSet);
                   }
                   
               }
               hiearchyMVMap.put(entry.getKey(), completeMVSet);

       }  
       
       return hiearchyMVMap;
      
  }
 

  
  private static void printOutFlatten(){
      Map<String,HashSet<String>> keyMVMap=flattenField("TerritoryUserNarrow.csv");
      int i=1;
       for (Map.Entry<String, HashSet<String>> entry : keyMVMap.entrySet()) {
            System.out.print("Key :"+entry.getKey() +"  MV : ");
               HashSet<String> hashSet =entry.getValue();
               for (String s : hashSet) {
            System.out.print(s);
               }
               System.out.println();
               System.out.println(i++);
        }
  }
  
  private static void printFlattenFile(){
    //  Map<String,HashSet<String>> keyMVMap=flattenField("TerritoryUserNarrow.csv");
      Map<String,HashSet<String>> keyMVMap=joinMVtoHiearchy("TerritoryNarrow.csv","TerritoryUserNarrow.csv");
      BufferedWriter bw=null;
        String line=null;
        File fileOut=null;
        int noOfLines=0;
        try {
            fileOut=FileUtils.getFile(FILE_DIR+"TerritoryUsersComplete.csv");
            bw=new BufferedWriter(new FileWriter(fileOut));
            bw.write("TerritoryId,UserIds");
       for (Map.Entry<String, HashSet<String>> entry : keyMVMap.entrySet()) {
               HashSet<String> hashSet =entry.getValue();
               StringBuffer sbuf=new StringBuffer();
               sbuf.append(entry.getKey()).append(DELIM);
               for (String s : hashSet) {
                   sbuf.append(s).append("|");
               }
               log("last index "+sbuf.lastIndexOf(""));
               line=sbuf.toString();
               line =line.substring(0,line.lastIndexOf("|"));
               bw.newLine();
               bw.write(line);
       }
          
        }catch (Exception e){
            log("Total of lines :"+(noOfLines));
            e.printStackTrace();
        }finally{
            if(bw!=null)try{bw.close();}catch(IOException ioe){}
        }
  }
  private static void printNormalizedFile(){
          Map<String,HashSet<String>> keyMVMap=joinMVtoHiearchy("TerritoryNarrow.csv","TerritoryUserNarrow.csv");
          BufferedWriter bw=null;
            String line=null;
            File fileOut=null;
            int noOfLines=0;
            try {
                fileOut=FileUtils.getFile(FILE_DIR+"TerritoryUserNormalized.csv");
                bw=new BufferedWriter(new FileWriter(fileOut));
                bw.write("TerritoryId,UserId");
           for (Map.Entry<String, HashSet<String>> entry : keyMVMap.entrySet()) {
                   HashSet<String> hashSet =entry.getValue();
                   
                   for (String s : hashSet) {
                       StringBuffer sbuf=new StringBuffer();
                       sbuf.append(entry.getKey()).append(DELIM).append(s);
                       line=sbuf.toString();
                       bw.newLine();
                       bw.write(line);
                   }
           }
              
            }catch (Exception e){
                log("Total of lines :"+(noOfLines));
                e.printStackTrace();
            }finally{
                if(bw!=null)try{bw.close();}catch(IOException ioe){}
            }
      }
  
  private static Map<String,HashSet<String>> flattenHiearchy(String aFileName){
        BufferedReader br=null;
        BufferedWriter bw=null;
        String line=null;
        File fileIn=null;
        long noOfLines=0;
        Map <String,String> childParentMap =new HashMap<String,String>();
        Map<String,HashSet<String>> keyMVMap=new HashMap <String,HashSet<String>>();
        HashSet<String> hiearchySet=null;
        
        try {
            long startTime =System.currentTimeMillis();
            fileIn =FileUtils.getFile(FILE_DIR+aFileName);
            br=new BufferedReader(new FileReader(fileIn));
            boolean isHeader=true;
            String id=null;
            String parentId=null;
            String childMostId=null;

            while ((line = br.readLine()) != null) {
                String[] fields=line.split(DELIM,-1);
                if(isHeader){
                    isHeader =false;
                }else {
                    id=fields[0];
                    if (StringUtils.isNotBlank(fields[1])){
                        
                        parentId=fields[1];
                    }else{
                        parentId=null;
                                        
                    }
                    childParentMap.put(id,parentId);                
                    }
                }
            
            for (Map.Entry<String, String> entry :childParentMap.entrySet()) {
                
                hiearchySet= new HashSet<String>();    
                addParentId(childParentMap,entry.getKey(),hiearchySet );
                keyMVMap.put(entry.getKey(),hiearchySet);
                
                
            }
                
            log("Duration ms : "+(System.currentTimeMillis()-startTime));
            
        }catch (Exception e){
            log("Total of lines :"+(noOfLines));
            e.printStackTrace();
        }finally{
            if(br!=null)try{br.close();}catch(IOException ioe){}
            if(bw!=null)try{bw.close();}catch(IOException ioe){}
            
        }
        return keyMVMap;
        
    
 
  }
  
  private static String addParentId(Map<String,String> childParentMap, String childId, HashSet<String> hiearchySet){
      hiearchySet.add(childId);
      String parentId =childParentMap.get(childId);
      if(parentId!=null){
          parentId=addParentId(childParentMap,parentId, hiearchySet);
      } 
      return parentId;
  }
  
  
  
  private  static Map<String,HashSet<String>> flattenField(String fileName){
        BufferedReader br=null;
        BufferedWriter bw=null;
        String line=null;
        File fileIn=null;
        long noOfLines=0;
        Map<String,HashSet<String>> keyMVMap=new HashMap <String,HashSet<String>>();
        HashSet<String> multiValue=null;
        
        try {
            long startTime =System.currentTimeMillis();
            fileIn =FileUtils.getFile(FILE_DIR+fileName);
            
            br=new BufferedReader(new FileReader(fileIn));
            
            boolean isHeader=true;
            String prevRowId=null;
            String currRowId=null;

            while ((line = br.readLine()) != null) {
                String[] fields=line.split(DELIM,-1);
                if(isHeader){
                    isHeader =false;
                }else {
                    if (StringUtils.isNotBlank(fields[1])){
                    currRowId=fields[0];
                    if(currRowId!=null&&!currRowId.equals(prevRowId)){
                        if(multiValue!=null){
                            keyMVMap.put(prevRowId, multiValue);
                        }
                        multiValue= new HashSet<String>();                    
                    }
                    multiValue.add(fields[1]);
                
                    }
                prevRowId=currRowId;
                }
                
            }
            if(multiValue!=null){
                keyMVMap.put(currRowId, multiValue);
            }
                
            log("Duration ms : "+(System.currentTimeMillis()-startTime));
            
        }catch (Exception e){
            log("Total of lines :"+(noOfLines));
            e.printStackTrace();
        }finally{
            if(br!=null)try{br.close();}catch(IOException ioe){}
            if(bw!=null)try{bw.close();}catch(IOException ioe){}
            
        }
        return keyMVMap;    
          
  }
  
    
    private static void log(Object aOut){
        System.out.println(aOut);
    }

  
}
 
Is there way through vf, I can add the full lightning calendar on the home page ? please help
Hi,

I want to create a vf template which will have collated opportunity/relatedobject information of a user.

It will be like

dear user.

your following opportunities and relatedobject__c are due. Please check their planned and approval dates.

Opportunity Object Table with 

Opportunitiy id, planned date, approval date


relatedobject__c  table with 

relatedobject__c id, planned date approval date

Regards,
Salesforce

The above template should be scheduled to send information everyday with the following condition..

All opportunities of a owner where planned date is less than today and approved date is missing

All relatedobjects of a owner where planned date is less than today and approved date is missing

Please guide...
Need assistance with a requirement

send an email everyday to record owners with a list of all their accounts and related contacts where industry is Apparel and the related contact has lastname as kumar
 
Need some guidance or a piece of code for the below mentioned scenario,

everyday at certain time, lets say at 9 am I want to send an email to opportunity owners with all their opportunities where amount is updated to 20000. so if one owner has 20 opportunity and has 20000 amount in each, then it will collate all these opportunity with their name and amount field and frame one email and send to the owner.

Please help me with the code if possible..
 
Hi, I am trying to combine two picklist values from two different objects for selection on my vf page.

let's say, I have an object opportunity with Stage picklist

there is another object as "Order Intake" which is the child of opportunity; it has a picklist which says if the oif days are due by options:
10 days
20 days
30 days

I am creating a picklist for vf page as 'Select category' where I want options as Stage values + Order Intake values;
when I select the options it should display respective Order Intake or opportunity.

Please assist
Hi I want to display contact and accounts in the same page, Account first with editable fields and a checkbox. once I click the checkbox it should display the related contact below it and allow me to edit it. Also, at  top there should be a industry listview to display accounts accordingly.. Below is the code and output screen which I am getting at the moment, please help

Apex
public class DiplayRelatedContacts {
   public List<Account> accList{get;set;}
   public list<Contact> conList{get;set;}
   public String accId{get;set;}
   public String str{get;set;}
   
     public DiplayRelatedContacts (){
     
     acclist=[SELECT Id,Name,AccountNumber, industry FROM Account Where industry=:str];
   
  
     
     }
      
   public List<SelectOption> Accountlist
    {
        get
        {
        
                   
            Accountlist= new List<SelectOption>();
             
                      
            for(Account acc: acclist)
            {
             //string str = String.valueOf(acc.getRelationshipNaryme());
             
             if(acc.industry!=null){
             
             string str=acc.industry;
            Accountlist.add(new SelectOption(str, str));
               // Accountlist.add(new SelectOption(acc.industry, acc.industry));
            }
            }
           return Accountlist;
           }
            
            set;
   }
   
   
   
    public PageReference dispalyContact() {
       if(accId != null)
       conList=[SELECT id,FirstName,LastName FROM Contact WHERE AccountId=:accId];
        return null;
    }
    
    public PageReference SaveAccount(){
    
     if(acclist.size()> 0){
     
       Update acclist;
       
       }
       
      
     return null;
  }
  
  
  
   public PageReference SaveContact(){
    
    if(conList.size()>0){
       Update conlist;
       
       }
       return null;
       }
}

________________________________________

VF page
<apex:page controller="DiplayRelatedContacts" id="pg">
    <apex:form id="frm">
      
           <apex:pageBlock>
             <apex:pageblockButtons>
            <apex:commandButton value="Save Account" action="{!SaveAccount}"/>
<apex:commandButton value="Save Contact" action="{!SaveContact}"/>
            </apex:pageblockButtons>
            
             </apex:pageBlock>
     
        <apex:pageBlock id="pgblk" >
        
     
        <apex:selectList size="3">
          <apex:selectOptions value="{!Accountlist}"></apex:selectOptions>
          </apex:selectlist>
       
        
            <apex:pageBlockTable value="{!acclist}" var="ac">
                <apex:column width="10px">
                    <input type="radio" name="group1" />
                    <apex:actionSupport event="onclick" action="{!dispalyContact}" ReRender="conpgblk" >
                        <apex:param assignTo="{!accId}" name="accname" value="{!ac.id}"/>
                    </apex:actionSupport>
                </apex:column>
                <apex:column headervalue="Account Name">
                <apex:inputfield value="{!ac.Name}" />
                </apex:column>
                 <apex:column headervalue="Account Number">
                <apex:inputfield value="{!ac.AccountNumber}" />
                </apex:column>
                
                <apex:column headervalue="Account Industry">
                <apex:inputfield value="{!ac.industry}" />
                </apex:column>
            </apex:pageBlockTable>
                    </apex:pageBlock>
        <apex:pageBlock id="conpgblk" >
            <apex:outputPanel rendered="{!conList.size == 0}">
                <b> NO RELATED CONTACTS FOR THIS ACCOUNT .</b>
            </apex:outputPanel>
            <apex:outputPanel rendered="{!conList.size != 0}">
                <apex:pageBlockTable value="{!conList}" var="con">
                    <apex:column headervalue="Firstname">
                    <apex:inputfield value="{!con.FirstName}"/>
                    </apex:column>
                     <apex:column headervalue="Last Name">
                    <apex:inputfield value="{!con.LastName}"/>
                    </apex:column>                            
                   
                </apex:pageBlockTable>
                    </apex:outputPanel>
           
        </apex:pageBlock>
    </apex:form>
</apex:page>
_______
the Output page
User-added image

 
Hi 

I want to show a listview with selectoption to filter the parent records with editable fields and a save button with a checkbox on VF page. Once I check the box, it should show the child records with editable fields with a save button. The related record should appear below the the respective parent records once checked.
managed package expiration date missing why; I am looking for the expiration date of package, Salesforce Communities Management (for Communities with Chatter. I found it a free package, does this mean that it will never expire...I wanted to track if it is active in the organization too.. check the below mentioned article, but it did not help:

https://help.salesforce.com/articleView?id=distribution_package_detail.htm&type=5
Hi,

I want to edit opportunity record and its related child record at the same page in vf; once I check the opportunity it should show its related child record and allow me to make changes to both opportunity and child record. Currently I can do it on two separate pages. below are the current lines of the code for apex and vf.. also, I should be able to manage the colums properly on my page so that i dont need to scroll the page..Please assist..

public class wrapperListOpportunity
{
    public list<wrapperOpp> wrappOppList{get;set;}
    public list<Opportunity> getOppList = new list<Opportunity>();
    public list<Order_Intake_Forecast__c> oifList{get;set;}
    Public list<Order_Intake_Forecast__c > oilist{get;set;}
    Public list<opportunity> oplist{get;set;}
    public boolean selectedCheck{get;set;}
    public String strDQIDueDays{get;set;}

    public List<SelectOption> getDQIDueDays(){
        Schema.DescribeFieldResult F =  Opportunity.DQI_Due_In_Days__c.getDescribe();
        List<Schema.PicklistEntry> P = F.getPicklistValues();
        List<SelectOption> options = new List<SelectOption>();
        //options.add(new SelectOption('','--All--'));
        for(Integer i = 0; i < P.size(); i++){
            options.add(new SelectOption(P[i].getValue(), P[i].getLabel()));
        }
        return options;
    }
    
  public wrapperListOpportunity()
    {   selectedCheck = false;
        wrappOppList = new list<wrapperOpp>();
       for(Opportunity op : [SELECT id,name, G2_Planned_Date__c,G3_Planned_Date__c, G4_Planned_Date__c, G5_Planned_Date__c, G6_Planned_Date__c, G2_Approval_Date__c, G3_Approval_Date__c, G4_Approval_Date__c, G5_Approval_Date__c, G6_Approval_Date__c from Opportunity 
       where ((G2_Planned_Date__c=:date.today() OR G2_Planned_Date__c=NEXT_N_DAYS:5) AND G2_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G3_Planned_Date__c=:date.today() OR G3_Planned_Date__c=NEXT_N_DAYS:5) AND G3_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G3_Planned_Date__c=:date.today() OR G3_Planned_Date__c=NEXT_N_DAYS:5) AND G3_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G4_Planned_Date__c=:date.today() OR G4_Planned_Date__c=NEXT_N_DAYS:5) AND G4_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G5_Planned_Date__c=:date.today() OR G5_Planned_Date__c=NEXT_N_DAYS:5) AND G5_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) ])
        {
            wrappOppList.add(new wrapperOpp(false,op));
        }
    }
    
    public pagereference DisplayData()
    {    
        selectedCheck = true;
        oifList = new list<Order_Intake_Forecast__c>();
        for(wrapperOpp op1 : wrappOppList)
        {
            if(op1.checked == true)
                getOppList.add(op1.opty);
                     }
        
        
       update getOppList;
       
      for(Order_Intake_Forecast__c o : [SELECT id,Business_Group__c, Business_Unit__c, Exclude_Reason__c, Forecast_Category__c, 
      L4_Name__c, L5_Name__c, Close_Date__c,Opportunity__c from Order_Intake_Forecast__c where Opportunity__c IN :getOppList])

        {
          oifList.add(o);
        }
        
        update oifList;
        // selectedCheck = false;
         return null;
        }
        
         
        public pagereference SaveOpportunity(){
        
        for(integer i=0;i<wrappOppList.size();i++){
        
        if(wrappOppList[i].checked== true)
            {
               
           update wrappOppList[i].opty;
         }
       // update oifList;
       }
        pagereference ref = new pagereference('/apex/OpportunityOIFEdit');
        ref.setredirect(true);
        return ref;
    }
    
    public pagereference SaveOif(){
         //update getOppList;
                
        if(oiflist.size()>0){
        
        update oiflist;
        }
        pagereference ref = new pagereference('/apex/OpportunityOIFEdit');
        ref.setredirect(true);
        return ref;
    }
    
   
   
public class wrapperOpp
{
    public Opportunity opty{get;set;}
    public Boolean checked{get;set;}
    
    Public wrapperOpp(Boolean bool,Opportunity aa)
    {
        opty = aa;
        checked = bool;
    }
}
}

VF
_______________
<apex:page controller="wrapperListOpportunity">
    
   
    <apex:form >
        <apex:outputPanel rendered="{!selectedCheck == false}">
        <apex:pageBlock >      
        <apex:selectList size="1" id="DQIDuedays" value="{!strDQIDueDays}">
        <apex:selectOptions value="{!DQIDueDays}"/>
        </apex:selectList>
        <apex:pageBlockTable value="{!wrappOppList}" var="w" id="test">
        <apex:column headerValue="Checkbox">
        <apex:inputCheckbox value="{!w.checked}" >
        <apex:actionSupport event="onclick" reRender="test"/>
        </apex:inputCheckbox>
        </apex:column>
        <apex:column headervalue="Name">
        <apex:inputfield value="{!w.opty.Name}"/>
        </apex:column>
        <apex:column headerValue="G2 Planned date">
        <apex:inputfield value="{!w.opty.G2_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G3 Planned date">
        <apex:inputfield value="{!w.opty.G3_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G4 Planned date">
        <apex:inputfield value="{!w.opty.G4_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G5 Planned date">
        <apex:inputfield value="{!w.opty.G5_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G2 Approval_Date">
        <apex:inputfield value="{!w.opty.G2_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G3 Approval_Date">
        <apex:inputfield value="{!w.opty.G3_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G4 Approval_Date">
        <apex:inputfield value="{!w.opty.G4_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G5 Approval_Date">
        <apex:inputfield value="{!w.opty.G5_Approval_Date__c}"/>
        </apex:column>
        </apex:pageBlockTable>
        <apex:pageBlockButtons >
        <apex:commandButton value="Display Record" action="{!DisplayData}"/>
        <apex:commandButton value="Save Opportunity" action="{!SaveOpportunity}"/>
        </apex:pageBlockButtons>
        </apex:pageBlock>
        </apex:outputPanel>
        
        
        <apex:outputPanel >
        <apex:pageBlock rendered="{!selectedCheck == true}">
        <apex:pageBlockTable value="{!oifList}" var="oif">
        <apex:column headerValue="Opportunity Name">
        <apex:inputfield value="{!oif.Opportunity__c}"/>
        </apex:column>
        <apex:column headerValue="Business Group">
        <apex:inputfield value="{!oif.Business_Group__c}"/>
        </apex:column>
        <apex:column headerValue="Business Unit">
        <apex:inputfield value="{!oif.Business_Unit__c}"/>
        </apex:column>
        <apex:column headerValue="Exclude Reason">
        <apex:outputfield value="{!oif.Exclude_Reason__c}"/>
        </apex:column>
        <apex:column headerValue="Forecast Category">
        <apex:inputfield value="{!oif.Forecast_Category__c}"/>
        </apex:column>
        </apex:pageBlockTable>
        <apex:pageBlockButtons >
        <apex:commandButton value="Save OIF" action="{!SaveOif}"/>
        </apex:pageBlockButtons>
        </apex:pageBlock>
        </apex:outputPanel>
</apex:form>
</apex:page>
 
I have been trying to get data through a http callout in batch class. its giving max callout time 120000 exceeded errorr any  suggestion on how it can be fixed?
Hi,

I want to create a vf template which will have collated opportunity/relatedobject information of a user.

It will be like

dear user.

your following opportunities and relatedobject__c are due. Please check their planned and approval dates.

Opportunity Object Table with 

Opportunitiy id, planned date, approval date


relatedobject__c  table with 

relatedobject__c id, planned date approval date

Regards,
Salesforce

The above template should be scheduled to send information everyday with the following condition..

All opportunities of a owner where planned date is less than today and approved date is missing

All relatedobjects of a owner where planned date is less than today and approved date is missing

Please guide...
There are two Objects:
1.Property__c(obj) with fields Status__c(Picklist) and Ajent__c(lookUp to Contact)
2.Contact (obj)
Scenerio:
Contact obj has some records 
if user change status__c of property form 'open' to 'working' the, If that user have a contact record, Agent__c field should get populated with that Contact Name field.  
Need some guidance or a piece of code for the below mentioned scenario,

everyday at certain time, lets say at 9 am I want to send an email to opportunity owners with all their opportunities where amount is updated to 20000. so if one owner has 20 opportunity and has 20000 amount in each, then it will collate all these opportunity with their name and amount field and frame one email and send to the owner.

Please help me with the code if possible..
 
Hi, I am trying to combine two picklist values from two different objects for selection on my vf page.

let's say, I have an object opportunity with Stage picklist

there is another object as "Order Intake" which is the child of opportunity; it has a picklist which says if the oif days are due by options:
10 days
20 days
30 days

I am creating a picklist for vf page as 'Select category' where I want options as Stage values + Order Intake values;
when I select the options it should display respective Order Intake or opportunity.

Please assist
Hi,

I want to edit opportunity record and its related child record at the same page in vf; once I check the opportunity it should show its related child record and allow me to make changes to both opportunity and child record. Currently I can do it on two separate pages. below are the current lines of the code for apex and vf.. also, I should be able to manage the colums properly on my page so that i dont need to scroll the page..Please assist..

public class wrapperListOpportunity
{
    public list<wrapperOpp> wrappOppList{get;set;}
    public list<Opportunity> getOppList = new list<Opportunity>();
    public list<Order_Intake_Forecast__c> oifList{get;set;}
    Public list<Order_Intake_Forecast__c > oilist{get;set;}
    Public list<opportunity> oplist{get;set;}
    public boolean selectedCheck{get;set;}
    public String strDQIDueDays{get;set;}

    public List<SelectOption> getDQIDueDays(){
        Schema.DescribeFieldResult F =  Opportunity.DQI_Due_In_Days__c.getDescribe();
        List<Schema.PicklistEntry> P = F.getPicklistValues();
        List<SelectOption> options = new List<SelectOption>();
        //options.add(new SelectOption('','--All--'));
        for(Integer i = 0; i < P.size(); i++){
            options.add(new SelectOption(P[i].getValue(), P[i].getLabel()));
        }
        return options;
    }
    
  public wrapperListOpportunity()
    {   selectedCheck = false;
        wrappOppList = new list<wrapperOpp>();
       for(Opportunity op : [SELECT id,name, G2_Planned_Date__c,G3_Planned_Date__c, G4_Planned_Date__c, G5_Planned_Date__c, G6_Planned_Date__c, G2_Approval_Date__c, G3_Approval_Date__c, G4_Approval_Date__c, G5_Approval_Date__c, G6_Approval_Date__c from Opportunity 
       where ((G2_Planned_Date__c=:date.today() OR G2_Planned_Date__c=NEXT_N_DAYS:5) AND G2_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G3_Planned_Date__c=:date.today() OR G3_Planned_Date__c=NEXT_N_DAYS:5) AND G3_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G3_Planned_Date__c=:date.today() OR G3_Planned_Date__c=NEXT_N_DAYS:5) AND G3_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G4_Planned_Date__c=:date.today() OR G4_Planned_Date__c=NEXT_N_DAYS:5) AND G4_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) OR 
       ((G5_Planned_Date__c=:date.today() OR G5_Planned_Date__c=NEXT_N_DAYS:5) AND G5_Approval_Date__c = null AND DQI_Due_In_Days__c =: strDQIDueDays) ])
        {
            wrappOppList.add(new wrapperOpp(false,op));
        }
    }
    
    public pagereference DisplayData()
    {    
        selectedCheck = true;
        oifList = new list<Order_Intake_Forecast__c>();
        for(wrapperOpp op1 : wrappOppList)
        {
            if(op1.checked == true)
                getOppList.add(op1.opty);
                     }
        
        
       update getOppList;
       
      for(Order_Intake_Forecast__c o : [SELECT id,Business_Group__c, Business_Unit__c, Exclude_Reason__c, Forecast_Category__c, 
      L4_Name__c, L5_Name__c, Close_Date__c,Opportunity__c from Order_Intake_Forecast__c where Opportunity__c IN :getOppList])

        {
          oifList.add(o);
        }
        
        update oifList;
        // selectedCheck = false;
         return null;
        }
        
         
        public pagereference SaveOpportunity(){
        
        for(integer i=0;i<wrappOppList.size();i++){
        
        if(wrappOppList[i].checked== true)
            {
               
           update wrappOppList[i].opty;
         }
       // update oifList;
       }
        pagereference ref = new pagereference('/apex/OpportunityOIFEdit');
        ref.setredirect(true);
        return ref;
    }
    
    public pagereference SaveOif(){
         //update getOppList;
                
        if(oiflist.size()>0){
        
        update oiflist;
        }
        pagereference ref = new pagereference('/apex/OpportunityOIFEdit');
        ref.setredirect(true);
        return ref;
    }
    
   
   
public class wrapperOpp
{
    public Opportunity opty{get;set;}
    public Boolean checked{get;set;}
    
    Public wrapperOpp(Boolean bool,Opportunity aa)
    {
        opty = aa;
        checked = bool;
    }
}
}

VF
_______________
<apex:page controller="wrapperListOpportunity">
    
   
    <apex:form >
        <apex:outputPanel rendered="{!selectedCheck == false}">
        <apex:pageBlock >      
        <apex:selectList size="1" id="DQIDuedays" value="{!strDQIDueDays}">
        <apex:selectOptions value="{!DQIDueDays}"/>
        </apex:selectList>
        <apex:pageBlockTable value="{!wrappOppList}" var="w" id="test">
        <apex:column headerValue="Checkbox">
        <apex:inputCheckbox value="{!w.checked}" >
        <apex:actionSupport event="onclick" reRender="test"/>
        </apex:inputCheckbox>
        </apex:column>
        <apex:column headervalue="Name">
        <apex:inputfield value="{!w.opty.Name}"/>
        </apex:column>
        <apex:column headerValue="G2 Planned date">
        <apex:inputfield value="{!w.opty.G2_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G3 Planned date">
        <apex:inputfield value="{!w.opty.G3_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G4 Planned date">
        <apex:inputfield value="{!w.opty.G4_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G5 Planned date">
        <apex:inputfield value="{!w.opty.G5_Planned_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G2 Approval_Date">
        <apex:inputfield value="{!w.opty.G2_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G3 Approval_Date">
        <apex:inputfield value="{!w.opty.G3_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G4 Approval_Date">
        <apex:inputfield value="{!w.opty.G4_Approval_Date__c}"/>
        </apex:column>
        <apex:column headerValue="G5 Approval_Date">
        <apex:inputfield value="{!w.opty.G5_Approval_Date__c}"/>
        </apex:column>
        </apex:pageBlockTable>
        <apex:pageBlockButtons >
        <apex:commandButton value="Display Record" action="{!DisplayData}"/>
        <apex:commandButton value="Save Opportunity" action="{!SaveOpportunity}"/>
        </apex:pageBlockButtons>
        </apex:pageBlock>
        </apex:outputPanel>
        
        
        <apex:outputPanel >
        <apex:pageBlock rendered="{!selectedCheck == true}">
        <apex:pageBlockTable value="{!oifList}" var="oif">
        <apex:column headerValue="Opportunity Name">
        <apex:inputfield value="{!oif.Opportunity__c}"/>
        </apex:column>
        <apex:column headerValue="Business Group">
        <apex:inputfield value="{!oif.Business_Group__c}"/>
        </apex:column>
        <apex:column headerValue="Business Unit">
        <apex:inputfield value="{!oif.Business_Unit__c}"/>
        </apex:column>
        <apex:column headerValue="Exclude Reason">
        <apex:outputfield value="{!oif.Exclude_Reason__c}"/>
        </apex:column>
        <apex:column headerValue="Forecast Category">
        <apex:inputfield value="{!oif.Forecast_Category__c}"/>
        </apex:column>
        </apex:pageBlockTable>
        <apex:pageBlockButtons >
        <apex:commandButton value="Save OIF" action="{!SaveOif}"/>
        </apex:pageBlockButtons>
        </apex:pageBlock>
        </apex:outputPanel>
</apex:form>
</apex:page>