• Marco Santos
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Hi, 

Could enybody tell me how to change this for loop to put the SOQL outside the for loop to efficiently query records?
for (Opportunity Opp :Trigger.new){

    	Boolean flag = false;

    	Account a = [Select id, name from Account where Id = :Opp.AccountId][0];

    	if (a.Name == 'XB Sample') {
    		flag = true;
    	}
}

 I will be apreciate for help

Thanks
Hi,

Could anybody help me with a formula field? Namely how I can use formula to choose the latest date for example:

a = 09/09/2013
b = 11/10/2014
c = 01/01/2010

What if 2 fields are empty how it can be handled in the formula below . This formula is working perfectly but only if all fields are populated with date:

if(a>b && a>c,a,if(b>a && b>c,b,c))

Thanks in advence
 
Hi
Could anybody help me with a formula field? Namely how I can use formula to choose the latest date for example:

DateA__c = 09/09/2013
DateB__c = 11/10/2014
DateC__c = 01/01/2010

Thanks in advance
Hi,
Could somebody help me round a number in my apex code?. Namely I have a number for example:
53732.99999999, then I would round this number to 53,733.00
Currently I am using the following code:
roundNumber.setScale(2,System.Roundingmode.DOWN).format(),
although is not formating the number correctly as I am receiving 53,732.99. Any help will be appreciated

Thank in advance
Hi all
Could somebody tell me how I can write unit test for the following method. I am new to apex so I really have no idea how it should be started, I will be very appreciate for any help
public static void PopulateRate(List<Sales__c> newSalesRecords){
        try {
		
            Map<String, Double> isoCodeToRate=AccountUtils.GetConversionRates();
			
			for (Sales__c sRecord : newSalesRecords)
            {
      
				if (sRecord.Rate__c == null){
					sRecord.Rate__c = isoCodeToRate.get(sRecord.Currency__c.toUpperCase());
				}
            }
        }
        catch (Exception e) {
        	
            throw new SalesTriggerException('Error =' + e.getMessage(), e);
        }
		
}
Thanks in advance
 
Hi, 

Could enybody tell me how to change this for loop to put the SOQL outside the for loop to efficiently query records?
for (Opportunity Opp :Trigger.new){

    	Boolean flag = false;

    	Account a = [Select id, name from Account where Id = :Opp.AccountId][0];

    	if (a.Name == 'XB Sample') {
    		flag = true;
    	}
}

 I will be apreciate for help

Thanks
Hi,

Could anybody help me with a formula field? Namely how I can use formula to choose the latest date for example:

a = 09/09/2013
b = 11/10/2014
c = 01/01/2010

What if 2 fields are empty how it can be handled in the formula below . This formula is working perfectly but only if all fields are populated with date:

if(a>b && a>c,a,if(b>a && b>c,b,c))

Thanks in advence
 
Hi
Could anybody help me with a formula field? Namely how I can use formula to choose the latest date for example:

DateA__c = 09/09/2013
DateB__c = 11/10/2014
DateC__c = 01/01/2010

Thanks in advance
Hi,
Could somebody help me round a number in my apex code?. Namely I have a number for example:
53732.99999999, then I would round this number to 53,733.00
Currently I am using the following code:
roundNumber.setScale(2,System.Roundingmode.DOWN).format(),
although is not formating the number correctly as I am receiving 53,732.99. Any help will be appreciated

Thank in advance
Hi all
Could somebody tell me how I can write unit test for the following method. I am new to apex so I really have no idea how it should be started, I will be very appreciate for any help
public static void PopulateRate(List<Sales__c> newSalesRecords){
        try {
		
            Map<String, Double> isoCodeToRate=AccountUtils.GetConversionRates();
			
			for (Sales__c sRecord : newSalesRecords)
            {
      
				if (sRecord.Rate__c == null){
					sRecord.Rate__c = isoCodeToRate.get(sRecord.Currency__c.toUpperCase());
				}
            }
        }
        catch (Exception e) {
        	
            throw new SalesTriggerException('Error =' + e.getMessage(), e);
        }
		
}
Thanks in advance