• james7630
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

I have a string that is a currency from excel and im importing it into salesforce into a currency field. It fails on bigger numbers that have a comma, I am trying to remove the $ and the commas but it doesnt work.

 

for(String fi: row)
{
Decimal di = 0.0;
if(fi.contains('$'))
{
fi = fi.trim();
fi = fi.replace(',','');
fi = fi.replace('$','');
di = Double.valueOf(fi);
}

 

error

Caused by: System.TypeException: Invalid double: "$6546456 "

I want to have a date field on a page above my datatable where I can click a date and that date is then used in the query that populates the datatable objects. I have the date field and the datatable but cant seem to get them working together. I can populate the datatable on intial load by hard coding  date,today for the query. 

 

public class RenewalController
{

    public RenewalController(ApexPages.StandardController controller) 
    { }


    public String getDate() 
    {
        return selectedAccount;
    }


public String selectedAccount { get; set; }  

public  List<Entities__c> myents = new List<Entities__c>();

    public List<Entities__c> getMyList() 
    {
    date dt;
    if(getDate()!= null)
        dt = Date.parse(getDate());
    else
        dt = date.Today();
        
        integer mo = dt.month();
 
        myents = [select id,Packet_Sent__c,Stamped_List_Received_from_State__c,Renewal_Emailed__c ,List_Filed_with_State__c,Received_Payment_For_Renewal__c,Renewal_Received_From_State__c ,State_Renewal__c,Renewal_Printed__c, Primary_Client__c, Name from Entities__c where (CALENDAR_MONTH(State_Renewal__c) =: mo)];
   
       return myents;
    }
 
 }

 page

<apex:page standardController="Entities__c" extensions="RenewalController" tabStyle="Entities__c" sidebar="false">
  <apex:form >
  <input id="datefield1" name="datefield1" onfocus="DatePicker.pickDate(false, 'datefield1', false);" size="12" type="text" value="">
  <apex:param name="id" value="{!Date}" assignTo="{!selectedAccount}"/>
  </input>
    <apex:pageBlock title="Entity" mode="edit" id="ent">
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}" rerender="ents" status="ajaxStatus"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
        <apex:commandButton value="AutoFillDate" action="{!AutoFill}" rerender="ents" status="ajaxStatus"/>
        
      </apex:pageBlockButtons>
      
      <apex:dataTable value="{!myList}" var="opp" id="ents">
      <apex:actionSupport event="onchange"
                      rerender="ent"
                      status="status"/>

      <apex:column headerValue="Entity">{!opp.Name}&nbsp;</apex:column>
        <apex:column headerValue="Renewal Due Date">
        <apex:inputField value="{!opp.State_Renewal__c}" id="renew"/>
        </apex:column>
        <apex:column headerValue="Renewal Received">
        <apex:inputField value="{!opp.Renewal_Received_From_State__c}"/>
        </apex:column>
        <apex:column headerValue="Printed Renewal">
         <apex:inputField value="{!opp.Renewal_Printed__c}" id="print"/>
        </apex:column>
        <apex:column headerValue="Emailed Renewal">
        <apex:inputField value="{!opp.Renewal_Emailed__c}"/>
        </apex:column>
        <apex:column headerValue="Rec Pay For Renewal">
        <apex:inputField value="{!opp.Received_Payment_For_Renewal__c}"/>
        </apex:column>
        <apex:column headerValue="List Filed With State">
        <apex:inputField value="{!opp.List_Filed_with_State__c}"/>
        </apex:column>
        <apex:column headerValue="Stamped List Received">
        <apex:inputField value="{!opp.Stamped_List_Received_from_State__c}"/>
        </apex:column>
        <apex:column headerValue="Packet Sent">
       <apex:inputField value="{!opp.Packet_Sent__c}"/>
        </apex:column>
      </apex:dataTable>
     
      <script>
          function CopyShipInfo()
          {
            document.getElementById('{!$Component.ents.renew}').value = document.getElementById('datefield1').value;
        </script>
         
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

I have a data table of date fields, I need to be able to have a field at the top not in the table where i can change the date and click copy and it copies to all in that one column. I have tried java script with no luck.. I am just hard coding the date now, i can figure out the input field, I just need to know how to copy it to that first column...

 

<apex:page Controller="RenewalController" tabStyle="Entities__c" sidebar="false">
  <apex:form >
    <apex:pageBlock title="Entity" mode="edit" id="ent">
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
        <apex:commandLink onclick="return CopyShipInfo()" value="CopyTo Renewal Due Date" reRender="ent"/>
      </apex:pageBlockButtons>
      
      <apex:dataTable value="{!myList}" var="opp" id="ents">
      <apex:column headerValue="Entity">{!opp.Name}&nbsp;</apex:column>
        <apex:column headerValue="Renewal Due Date">
        <apex:inputField value="{!opp.State_Renewal__c}"/>
        </apex:column>
        <apex:column headerValue="Renewal Received">
        <apex:inputField value="{!opp.Renewal_Received_From_State__c}" id="renew"/>
        </apex:column>
        <apex:column headerValue="Printed Renewal">
         <apex:inputField value="{!opp.Renewal_Printed__c}"/>
        </apex:column>
        <apex:column headerValue="Emailed Renewal">
        <apex:inputField value="{!opp.Renewal_Emailed__c}"/>
        </apex:column>
        <apex:column headerValue="Rec Pay For Renewal">
        <apex:inputField value="{!opp.Received_Payment_For_Renewal__c}"/>
        </apex:column>
        <apex:column headerValue="List Filed With State">
        <apex:inputField value="{!opp.List_Filed_with_State__c}"/>
        </apex:column>
        <apex:column headerValue="Stamped List Received">
        <apex:inputField value="{!opp.Stamped_List_Received_from_State__c}"/>
        </apex:column>
        <apex:column headerValue="Packet Sent">
       <apex:inputField value="{!opp.Packet_Sent__c}"/>
        </apex:column>
      </apex:dataTable>
     
     
         <script>
          function CopyShipInfo()
          {
            document.getElementById('{!$Component.ents.renew}').value = '01/01/1976';
        </script>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

I have a string that is a currency from excel and im importing it into salesforce into a currency field. It fails on bigger numbers that have a comma, I am trying to remove the $ and the commas but it doesnt work.

 

for(String fi: row)
{
Decimal di = 0.0;
if(fi.contains('$'))
{
fi = fi.trim();
fi = fi.replace(',','');
fi = fi.replace('$','');
di = Double.valueOf(fi);
}

 

error

Caused by: System.TypeException: Invalid double: "$6546456 "

I want to have a date field on a page above my datatable where I can click a date and that date is then used in the query that populates the datatable objects. I have the date field and the datatable but cant seem to get them working together. I can populate the datatable on intial load by hard coding  date,today for the query. 

 

public class RenewalController
{

    public RenewalController(ApexPages.StandardController controller) 
    { }


    public String getDate() 
    {
        return selectedAccount;
    }


public String selectedAccount { get; set; }  

public  List<Entities__c> myents = new List<Entities__c>();

    public List<Entities__c> getMyList() 
    {
    date dt;
    if(getDate()!= null)
        dt = Date.parse(getDate());
    else
        dt = date.Today();
        
        integer mo = dt.month();
 
        myents = [select id,Packet_Sent__c,Stamped_List_Received_from_State__c,Renewal_Emailed__c ,List_Filed_with_State__c,Received_Payment_For_Renewal__c,Renewal_Received_From_State__c ,State_Renewal__c,Renewal_Printed__c, Primary_Client__c, Name from Entities__c where (CALENDAR_MONTH(State_Renewal__c) =: mo)];
   
       return myents;
    }
 
 }

 page

<apex:page standardController="Entities__c" extensions="RenewalController" tabStyle="Entities__c" sidebar="false">
  <apex:form >
  <input id="datefield1" name="datefield1" onfocus="DatePicker.pickDate(false, 'datefield1', false);" size="12" type="text" value="">
  <apex:param name="id" value="{!Date}" assignTo="{!selectedAccount}"/>
  </input>
    <apex:pageBlock title="Entity" mode="edit" id="ent">
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}" rerender="ents" status="ajaxStatus"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
        <apex:commandButton value="AutoFillDate" action="{!AutoFill}" rerender="ents" status="ajaxStatus"/>
        
      </apex:pageBlockButtons>
      
      <apex:dataTable value="{!myList}" var="opp" id="ents">
      <apex:actionSupport event="onchange"
                      rerender="ent"
                      status="status"/>

      <apex:column headerValue="Entity">{!opp.Name}&nbsp;</apex:column>
        <apex:column headerValue="Renewal Due Date">
        <apex:inputField value="{!opp.State_Renewal__c}" id="renew"/>
        </apex:column>
        <apex:column headerValue="Renewal Received">
        <apex:inputField value="{!opp.Renewal_Received_From_State__c}"/>
        </apex:column>
        <apex:column headerValue="Printed Renewal">
         <apex:inputField value="{!opp.Renewal_Printed__c}" id="print"/>
        </apex:column>
        <apex:column headerValue="Emailed Renewal">
        <apex:inputField value="{!opp.Renewal_Emailed__c}"/>
        </apex:column>
        <apex:column headerValue="Rec Pay For Renewal">
        <apex:inputField value="{!opp.Received_Payment_For_Renewal__c}"/>
        </apex:column>
        <apex:column headerValue="List Filed With State">
        <apex:inputField value="{!opp.List_Filed_with_State__c}"/>
        </apex:column>
        <apex:column headerValue="Stamped List Received">
        <apex:inputField value="{!opp.Stamped_List_Received_from_State__c}"/>
        </apex:column>
        <apex:column headerValue="Packet Sent">
       <apex:inputField value="{!opp.Packet_Sent__c}"/>
        </apex:column>
      </apex:dataTable>
     
      <script>
          function CopyShipInfo()
          {
            document.getElementById('{!$Component.ents.renew}').value = document.getElementById('datefield1').value;
        </script>
         
    </apex:pageBlock>
  </apex:form>
</apex:page>