• bca321
  • NEWBIE
  • 5 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 26
    Replies

Hi,

 

Can u explain what is cloud computing?

  • March 24, 2009
  • Like
  • 0

Hi

 

I have a text file. I tried to import text file data to salesforce custom object. One file has several pages. each page has same format. I tried to import one page for may object. It's working. Now I want to attach several pages for my text file and import all "RECEIPS" parts for my same object. I want to import only "RECEIPT" data for an object. I took "RECEIPTS" and "TOTAL " words as a flags. I tried search "RECEIPTS" word and if found it insert data. Again if found "TOTAL" word continue. If found "TOTAL" i want to go to loop again find "RECEIPTS" word and again insert data. How can I do that one.


I think we can search like this:  Boolean IsRECEIPTS = false;

Document d = [SELECT id, Body from Document where id = '01580000000Uxou'];
        Blob bodyBlob = d.Body;
        String bodyStr = bodyBlob.toString();
        String[]lines = bodyStr.split('\\n');
        //System.debug('lines' + lines);
        //Boolean matchFound = m.find();
        String searchfor = 'RECEIPTS';
        Boolean matchFound = false;
        String input ='';
        for (integer i = 0; i < lines.size(); i++) {
             input = lines[i];
            if (input.contains(searchfor)) {
                input = input.replace(searchfor,'');
             }
        
            //output += input + '<br />';               
            String regex = '\\s*(\\d\\d\\s\\w\\w\\w\\s\\d\\d)\\s*(\\d+)\\s*(\\d+)\\s*(\\d*\\,*\\d+.\\d*)\\s*(\\d+)\\s*(\\d*\\,*\\d+.\\d*)\\s*';
            Pattern p = Pattern.compile(regex);       
            Matcher m = p.matcher(input);
            matchFound = m.find();
            output += matchFound ;
         
         if(matchFound){       
                    pDueDate = m.group(1);
                    FileNumber = double.valueOf(m.group(2));                   
                    DebitItems = double.valueOf(m.group(3));
                    DebitAmount = decimal.valueOf(m.group(4).replace(',',''));
                    CreditItems = double.valueOf(m.group(5));
                    String aa = m.group(6).replace(',','');
                    CreditAmount = decimal.valueOf(aa.replace('"',''));   
                    output += pDueDate + ' ' + FileNumber + ' ' + DebitItems + ' ' + DebitAmount + ' ' + CreditItems + ' ' + CreditAmount;
                    Receipt__c newReceipt = new Receipt__c();
                    newReceipt.Due_Date_del__c = customDate(pDueDate);
                    newReceipt.File_Number__c = FileNumber;
                    newReceipt.Debit_Items__c = DebitItems;
                    newReceipt.Debit_Amount__c = DebitAmount;
                    newReceipt.Credit_Items__c = CreditItems;
                    newReceipt.Credit_Amount__c = CreditAmount;
                    insert newReceipt;
                     newReceipt = null;                    
                     output += '\n<br>';                       
                }//if
                           
              if(input.contains('TOTAL')){
                    continue;
                }
           
                }
               return output;   
            
                 }              
}

  • March 16, 2009
  • Like
  • 0

Hi,

 

I tried to convert currency value String to decimal type.

 

String a = '';
            Decimal DebitAmount;
            a='';       
            if((a<>null)&&(a<>'')){
            DebitAmount = decimal.valueOf(a);
            }
            system.debug('\n\n String a='+a);
            system.debug('\n\n Decimal DebitAmount='+DebitAmount);

 

And this value I insert to salesforce.

 

My regular expersion is (\\d*\\,*\\d+.\\d*)

 

DebitAmount = decimal.valueOf(m.group(1).replace(',',''));

newReceipt.Debit_Amount__c = DebitAmount; 

insert newReceipt;

 

Currency ex: 66,967.78 But after insert the salesforce this value convert to as a  rounded  value. (66,968). But I want to actual value. Not the rounded value. How can I do it.

  • March 15, 2009
  • Like
  • 0
Message Edited by bca321 on 03-12-2009 10:06 AM
  • March 11, 2009
  • Like
  • 0
Message Edited by bca321 on 03-12-2009 10:07 AM
  • March 11, 2009
  • Like
  • 0

Message Edited by bca321 on 03-12-2009 10:08 AM
  • March 10, 2009
  • Like
  • 0
Message Edited by bca321 on 03-10-2009 07:41 PM
  • March 10, 2009
  • Like
  • 0

Hi,

 

Pl's tell me how to remove line from text file.

  • March 09, 2009
  • Like
  • 0
Message Edited by bca321 on 03-09-2009 09:47 AM
  • March 09, 2009
  • Like
  • 0
Message Edited by bca321 on 03-05-2009 04:11 AM
  • March 04, 2009
  • Like
  • 0
Message Edited by bca321 on 03-04-2009 12:34 PM
  • March 04, 2009
  • Like
  • 0
Message Edited by bca321 on 03-04-2009 09:37 AM
  • March 04, 2009
  • Like
  • 0
Message Edited by bca321 on 03-04-2009 04:27 AM
Message Edited by bca321 on 03-04-2009 05:01 AM
  • March 03, 2009
  • Like
  • 0

Hi.

 

My date method  is

 

Date submitDate;

 

string year = '';

string month = '';
string day = '';           
string stringDate = year + '-' + month + '-' + day;
Date SubmitDate = date.valueOf(stringDate);

 

But still error. help me

  • March 03, 2009
  • Like
  • 0

Message Edited by bca321 on 03-02-2009 08:42 PM
  • March 03, 2009
  • Like
  • 0
Message Edited by bca321 on 03-02-2009 08:00 PM
  • March 02, 2009
  • Like
  • 0

Hi,

 

I have text file and I want read data from 5th line. How can I skip line 1 - 5? and also empty lines I want to skip. Pl's explain me.

Message Edited by bca321 on 03-01-2009 08:14 AM
Message Edited by bca321 on 03-01-2009 08:36 AM
Message Edited by bca321 on 03-01-2009 08:40 AM
  • March 01, 2009
  • Like
  • 0

Hi,

 

My date field type is Date. date patern is yy-mm-dd.

 

String year = '';

String month = '';String day =

'';string stringDate = year + '' + month + '' + day;

Date DueDate = date.valueOf(stringDate);

 

my code is here. but still error. can you pl's tel me how to write code. and also I want to write regular expression for that date field.

  • February 26, 2009
  • Like
  • 0
Message Edited by bca321 on 02-26-2009 12:46 PM
  • February 24, 2009
  • Like
  • 0

Hi,

 

I want to know How to add the "regExp" for Apex code. I have list of data as a .txt file. I want to split that data put a array.

 

Help me.

 

  • February 18, 2009
  • Like
  • 0
Message Edited by bca321 on 03-12-2009 10:06 AM
  • March 11, 2009
  • Like
  • 0
Message Edited by bca321 on 03-10-2009 07:41 PM
  • March 10, 2009
  • Like
  • 0

Hi,

 

Pl's tell me how to remove line from text file.

  • March 09, 2009
  • Like
  • 0
Message Edited by bca321 on 03-09-2009 09:47 AM
  • March 09, 2009
  • Like
  • 0
Message Edited by bca321 on 03-04-2009 09:37 AM
  • March 04, 2009
  • Like
  • 0
Message Edited by bca321 on 03-04-2009 04:27 AM
Message Edited by bca321 on 03-04-2009 05:01 AM
  • March 03, 2009
  • Like
  • 0

Hi.

 

My date method  is

 

Date submitDate;

 

string year = '';

string month = '';
string day = '';           
string stringDate = year + '-' + month + '-' + day;
Date SubmitDate = date.valueOf(stringDate);

 

But still error. help me

  • March 03, 2009
  • Like
  • 0

Message Edited by bca321 on 03-02-2009 08:42 PM
  • March 03, 2009
  • Like
  • 0

Hi,

 

I have text file and I want read data from 5th line. How can I skip line 1 - 5? and also empty lines I want to skip. Pl's explain me.

Message Edited by bca321 on 03-01-2009 08:14 AM
Message Edited by bca321 on 03-01-2009 08:36 AM
Message Edited by bca321 on 03-01-2009 08:40 AM
  • March 01, 2009
  • Like
  • 0

Hi,

 

My date field type is Date. date patern is yy-mm-dd.

 

String year = '';

String month = '';String day =

'';string stringDate = year + '' + month + '' + day;

Date DueDate = date.valueOf(stringDate);

 

my code is here. but still error. can you pl's tel me how to write code. and also I want to write regular expression for that date field.

  • February 26, 2009
  • Like
  • 0
I made a trigger that updates somes values after update. But some fields are not the same type.

Is there any functionnality ( like toString)  to covnert My picklist values (String) to a double ( Like parseFloat in Javascript).


Thank you
  • February 05, 2008
  • Like
  • 0