+ Start a Discussion
Saikiran KolliSaikiran Kolli 

How to add integer values into string

Hi,

My Scenario is I'm having 15 boxes. Client will order 100 books. I'm having picklist box1,box2...box15 .
I will add 10books(order line items) in box 1
Again next 10 books in box 2.
Then after clicking on Save button it will recdirect to new page where all the data will be displayed.

In the new page when I select box 1, it must show the 10books.'(with their book name, quantity, supplied quantity will be displayed.)
same for other boxes.

Books are adding in the supplied quantity but When i select box 1 in the New page its not showing any quantity. For that I have to add order line items in box.

Selected box is string, Supplied quantity is integer. I need to add integer into string. Please help me
<apex:outputLabel >Choose Box to Save</apex:outputLabel>
                       
                    </apex:pageBlockSectionItem>
        <apex:selectList value="{!SelectedBox}" size="1">

                    <apex:selectOptions value="{!Boxoptions}"></apex:selectOptions>
                </apex:selectList>

Constructor: 

public bulkff(){
    Boxoptions=new list<SelectOption>();
    lineItemName=new set<String>();
       orderItemsList=new list<Order_Line_Items__c>();
       OrderLineItems();
       String boxnm='';
        Boxoptions.add(new SelectOption('--None--', '--None--'));
        for(integer i=1;i<=15;i++)
        {
            boxnm = 'Box '+i;
            Boxoptions.add(new SelectOption(boxnm, boxnm));
        }
       }


Method: 

     public void OrderLineItems(){
      Set<id> oid = new Set<id>();
        List < Order_Line_Items__c > listOfItems = new List < Order_Line_Items__c > ();
        order = [SELECT name, Total_supplied_quantity__c, Location__c, From_Date__c, To_Date__c, id, Status__c, Submitted_On__c, SystemModstamp, Total_Quantity__c, Total_Units__c FROM Orders__c Where Id = : ApexPages.currentPage().getParameters().get('id') ];
        for(Orders__c o : order)
        {
            oid.add(o.id);
        }
      
      orderItemsList = [Select Id, Name, Difference__c, Order__c, Quantity__c, Select_Box__c, Supplied_Quantity__c, Type__c from Order_Line_Items__c where Order__c=:Apexpages.currentpage().getParameters().get('id')];
       
        
        for(Order_Line_Items__c old : orderItemsList)
        {
            
             //   selectedbox.add(orderItemsList);   

// Here I'm trying to add orderitemslist into a selected box but its throwing an error, Incorrect signature, I tried in all ways but its not working. Please help me
                     
             
        }
}

 
Nayana KNayana K
Can you please post whole code?
SelectedBox is a String and you are trying to do List operation which is wrong.

Take a normal list like this : List<Order_Line_Items__c> lstOLI and add OLIs to it inside for loop.
Saikiran KolliSaikiran Kolli
Hi Nayana,

<apex:page controller="bulkff" sidebar="false" id="page" tabStyle="Orders__c">

  <html>

<title>Print Test Page</title>

 <style type="text/css">
   .outBorder {
    border:3px outset black;
   }
   .inBorder{
    border-top:2px inset black;
    border-left:2px inset black;
   }
    
  </style>
  
 
<script>

function printDiv(divId) 
{
       var result = document.getElementById('page:form:pb1:pbstbl:pbsi:sl').value;
        if (result == "--None--") 
            {
                alert("Please Select Box");
            }
            else{
  
        window.frames["print_frame"].document.body.innerHTML=document.getElementById(divId).innerHTML;
        window.frames["print_frame"].window.focus();
        window.frames["print_frame"].window.print();
        }      
  }  
</script>

<body>

</body>

    
    <script src="{!URLFOR($Resource.jQuery,'')}"/>
    <script type="text/javascript">
       var j$ = jQuery.noConflict();
       
      
           function focusme()
           {
               var inpele = j$("input[id$='xyz']");
               inpele.val("");
               inpele.focus();
           }
       
    </script>
  
    <apex:outputPanel id="errorpanel">
    <apex:pageMessages id="showMsg" />
    </apex:outputPanel>
    <apex:form id="form">
        <apex:pageBlock title="Bulk Fulfill" id="pb1" >
            <apex:outputpanel id="panel">
            
                <apex:pageBlockSection columns="1">
                
                   <apex:pageBlockSectionItem >
                        <apex:outputLabel >Choose Box to Save</apex:outputLabel>
                       
                    </apex:pageBlockSectionItem>
        <apex:selectList value="{!SelectedBox}" size="1">

                    <apex:selectOptions value="{!Boxoptions}"></apex:selectOptions>
                </apex:selectList>
                </apex:pageBlockSection>
                
                <apex:pageBlockSection columns="1" >
                 <apex:outputField value="{!order[0].name}"/>
                 <apex:outputField value="{!order[0].Location__c}" />
          
     <br/>
             </apex:pageblocksection>
             
               </apex:outputpanel>
      
    <apex:outputPanel id="tblpnl">
    <div id="itemsDiv">
  
     <apex:pageblockTable value="{!orderItemsList}" border="1" var="ord" id="theTable" rowClasses="odd,even" styleclass="outBorder" width="550px" rendered="{!orderItemsList.size>0}">
    
          <apex:column styleclass="inBorder">
             <apex:facet name="header">Subject</apex:facet>
              <apex:outputText value="{!ord.Name}"/>
         </apex:column>
        
        <apex:column styleclass="inBorder">
              <apex:facet name="header">Quantity</apex:facet>
              <apex:outputText value="{!ord.Quantity__c}"/>
        </apex:column>
        <apex:column styleclass="inBorder" >
            <apex:facet name="header">Supplied Quantity</apex:facet>
            <apex:inputText value="{!ord.Supplied_Quantity__c}"/>
            <apex:actionSupport event="onchange" action="{!updatevalue}"  reRender="pbstbl,xyz,errorpanel,pb1" oncomplete="focusme();"></apex:actionSupport>
        </apex:column>
    
       

  </apex:pageblockTable>
  
</div>
</apex:outputPanel>

   <apex:pageBlockButtons location="top">
   <apex:commandButton value="Save Value" action="{!updatevalue}"/>
   
   </apex:pageBlockButtons>             
           
   

        </apex:pageBlock>
    </apex:form>
    </html> 
</apex:page>






public with sharing class bulkff {
 public String SelectedBox{Set;Get;}
 public List<Orders__c> order {get;set;} 
 List < Order_Line_Items__c > listOfItems ;
 public list<SelectOption> Boxoptions{set;get;}
  Public list<Order_Line_Items__c> orderItemsList{Set;Get;}
  set<String> lineItemName{Set;Get;}
  public String oid{get;set;}
  public String olit{get;set;}
   public Order_Line_Items__c OrdlItem{Set;Get;}
    
    public bulkff(){
   Boxoptions=new list<SelectOption>();
    lineItemName=new set<String>();
       orderItemsList=new list<Order_Line_Items__c>();
       OrderLineItems();
       String boxnm='';
        Boxoptions.add(new SelectOption('--None--', '--None--'));
      for(integer i=1;i<=15;i++)
        {
            boxnm = 'Box '+i;
           Boxoptions.add(new SelectOption(boxnm, boxnm));
        }
        
       }
   
     public void OrderLineItems(){
      Set<id> oid = new Set<id>();
        List < Order_Line_Items__c > listOfItems = new List < Order_Line_Items__c > ();
        order = [SELECT name, Total_supplied_quantity__c, Location__c, From_Date__c, To_Date__c, id, Status__c, Submitted_On__c, SystemModstamp, Total_Quantity__c, Total_Units__c FROM Orders__c Where Id = : ApexPages.currentPage().getParameters().get('id') ];
        for(Orders__c o : order)
        {
            oid.add(o.id);
        }
      
      orderItemsList = [Select Id, Name, Difference__c, Order__c, Quantity__c, Select_Box__c, Supplied_Quantity__c, Type__c from Order_Line_Items__c where Order__c=:Apexpages.currentpage().getParameters().get('id')];
       
       list<selectoption> selectedbox = new list<selectoption>();
       
        
        for(Order_Line_Items__c old : orderItemsList)
        {
            
                //selectedbox.add(orderItemsList);
                     
             
        }
}

public void refresh()
{
if(SelectedBox=='' || SelectedBox==null || SelectedBox=='--None--')
       {
       
           ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select Box to save'));
     
       }
    for(Order_Line_Items__c old : orderItemsList)
        {
            
            listOfItems.add(old);
             //   selectedbox.add(orderItemsList);
                     
             
        }
       
}
     public pagereference updatevalue()
    {
       if(orderitemslist.size()>0)
        {
            update orderitemslist;
            OrderLineItems();
        }
  return new Pagereference('/apex/orderView?id='+order[0].id).setredirect(true); 
}    
}