• mulveling
  • NEWBIE
  • 205 Points
  • Member since 2009

  • Chatter
    Feed
  • 8
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 33
    Replies

If I return 200 records an put them in a list.

 

If i update 50 of them, what is the best way to perform the update:

 

1. Update the List (which triggers the update context triggers for all 200 records

    

     For(Account[] al : [Select ID, BillingPostalCode From Account Limit 200]){

           For(Account a : al){           

                      if (a.Name.contains('50')){ //Returns only 50 of the 200 records

                             a.BillingPostalCode = 54321;

           }

     update al;

     }

 

2. or keep track of the updated records and only update those 50 (at a cost to heap size)

 

Account[] tbuAcc = New Account[]{};

 

For(Account[] al : [Select ID, BillingPostalCode From Account Limit 200]){

           For(Account a : al){           

                      if (a.Name.contains('50')){ //Returns only 50 of the 200 records

                             a.BillingPostalCode = 54321;

                             tbuAcc.add(a);

           }

     if(tbuAcc.size() >0)

         update tbuAcc;

     }

 

 

Hi,

 

I am facing an issue while comparing two strings.

Both the strings are same but then on comparion the value returned is False.

There is a line break in both the strings and i suspect that is the reason for the failure.

Here's my code snippet

 

sg.commonField='Percentage of EAL students above National Average 49% of EAL students underachieving in English and 48% in Maths'

 

is.Issue__c= 'Percentage of EAL students above National Average 49% of EAL students underachieving in English and 48% in Maths'

 

if(sg.commonField.equalsignorecase(is.Issue__c))
          {
                      System.debug('inside common** '+is.id);
                         sg.subg.Issues_Smart_Targets__c=is.id;
          } 

 

The if condition returns False.

 

**sg.commonField and is.Issue__c are values from my wrapper class.

 

If the reason for this is line break as i suspected then how do I go about it and resolve the issue?

 

Anyone knows what is the default isolation level and if it is possible to change that? I have a use case as follows: I want to insert a record in an object if it does not exist, otherwise just update it. So I am doing a select (where say name = <some value>), if no record is returned, I create a new one, otherwise I update the existing one. But it appears that if two such calls are executed at the same time, I would end up creating two records (with same name). Anyone knows how to solve this problem?

  • November 21, 2011
  • Like
  • 0

I followed this tutorial on drop down lists to the T and I'm still getting "line breaks not allowed in string literals" in my eclipse...http://www.soliantconsulting.com/blog/2009/07/the-user-visualforce-and-apex-about-a-drop-down-menu/

public with sharing class mc_FCCContractNegotiation {

   //==================================================
    // PROPERTIES
    //==================================================
    public mc_Price_Sheet_Code_Entry__c pricesheetCodeEntry {get;private set;}
    public mc_Carrier_Contract_Negotiation__c ContractNeg      {get;private set;}
    public List<mc_CodeEntry>              codeEntries         {get;private set;}
    public List<mc_CodeEntry>              SGcodeEntries         {get;private set;}
    public String                           lookupCode          {get;        set;}
    public ApexPages.StandardSetController  pricesheetEntries   {get;private set;}
    private List Ranks;
    private String Rank;
      



        public mc_FCCContractNegotiation(ApexPages.StandardController controller) {
       	getRank();
       	
        this.ContractNeg = (mc_Carrier_Contract_Negotiation__c)controller.getRecord();
        //codeEntries = mc_CodeEntry.load(contractNeg.id, ContractNeg.getInstance('Standard Charge - Current Year'));
        lookupCode = null;
    }
    
        public PageReference doLoadCodes(){
        SGcodeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, 'a2N400000004CKqEAM');
        codeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, ContractNeg.Code_Price_Sheet__c);
        doSpecifyReimbursementRate();
        
        return null;
    }
    
            public PageReference doSpecifyReimbursementRate(){
            mc_CodeEntry.calculateReimbursementAmount(SGcodeEntries, ContractNeg.Rate__c);
            mc_CodeEntry.calculateReimbursementAmount(codeEntries, ContractNeg.Rate__c);
        return null;
    }
    
   	    public String getRank(){
			return this.Rank;
    	}
    	
    }
    	public List getRanks() {
  			List Ranks= new List();
  			Ranks.add(new SelectOption('00','Selection'));
  			Ranks.add(new SelectOption('ED','ED'));
  			Ranks.add(new SelectOption(’MC’,'MC’));
  			Ranks.add(new SelectOption(’HM’,'HM’));
  			Ranks.add(new SelectOption(’UC’,'UC’));

  			return Ranks;
	}
    
    	public String getRank(){
  			int val=0;
  			if(Rank == ‘ED’){
    				val = 1;
  				}else{
  		  			if(Rank == ‘MC’){
    						val = 2;
  			 			}else{
  			   				if(Rank == ‘HM’){
    		          				val = 3;
  			       				}else{
  			       	 				if(Rank == ‘UC’){
    				        				val = 4;
  			       	 				}
  			   				}
  		  			}
  			}
    	
  	
  		
  	return Rank;
	}
    
}

 

Any ideas?

I have a page with 5 data entry sections each of which is tied to a specific record type of the object. I would like to only show the one section that applies to the record type that was selected when creating the record. I found the references and code samples for the rendered attribute, but just can't seem to get the syntax correct. The code below is my latest attempt, but it won't save. The error is "Incorrect parameter for operator '='. Expected Object, received Text"

 

<apex:pageBlockSection title="Fee Waiver RME" rendered="{!RME__c.RecordType='012S00000000Pvm'}">

 

Any help would be appreciated.

 

I am trying to reveal an <apex:inputField> dynamically, specifically a date field.  It is part of an "Additional Info" pageblock section that looks like this.
<apex:pageBlockSection id="additionalInfo" title="Additional Status
Info">
    <apex:inputField rendered="{!show_a1}" value="{!mii.AI_01_Date__c}"/>
......
Above this, I have a nifty selection that forces a rerender of this pageBlockSection
<apex:inputField value="{!mii.Status__c}" >
   <apex:actionSupport event="onchange" action="{!filterMandatoryInput}"
                       rerender="additionalInfo"/> 
</apex:inputField>

 

So that is working fine.  When a user selects a status dropdown, additionalInfo rerenders, the show_a1 boolean gets flipped accordingly, and the AI_01_Date field suddenly appears.

The problem is that the screen did not originally render with a Date input field, so the DatePicker code did not get appended to the bottom of the page.  Long story short, the calendar does not pop up when you select inside of this date field.

 

Any suggestions as to how to include the DatePicker code on a visualforce page without starting the page with an inputfield linked to a Date field?

 

Thanks

 

I have an apex web service in an apex class that is called from the flex front end . The Flex is embedded in a VF page as a flash object <apex:flash> and I am logging into salesforce.com using the session Id (grabbing it from the controller using UserInfo.getSessionId()) and session URL = $Api.Partner_Server_URL_90.

 

I am developing in my sandbox.

 

The code for the apex class holding the webservice is as follows.

 

global class MyWebService 
{
	private static Datetime startDate {get; set;}
	private static Datetime endDate {get; set;}
	
	
	global class LeadObject
	{
		public String name {get; set;}
		public String Id {get; set;}
		public String country {get; set;}
		public String city {get; set;}
		public String status {get; set;}
		public String annual_Rev_Range {get; set;}
		public String score {get; set;}
		public String company {get; set;}
		
		public LeadObject(Lead lead)
		{
			name = lead.Name;
			Id = lead.Id;
			country = lead.Country;
			city = lead.City;
			status = lead.Status;
			annual_Rev_Range = lead.Annual_Revenue_Range__c;
			company = lead.Company;
			score = lead.Score__c.format();
		} 
	}
	
	Webservice static List<LeadObject> getLeads(String startDateString , String startMonthString , String startYearString,
															String endDateString , String endMonthString , String endYearString)
	{
		List<LeadObject> result = new List<LeadObject>();
		
		//set the start and the end dates
		setDates(startDateString , startMonthString , startYearString,
				endDateString , endMonthString , endYearString);
		
		//get Leads Data
		List<Lead_Key_Event__c> leadKEs;
		leadKEs = new List<Lead_Key_Event__c>();
		
		List<String> leadIds = getLeadIds(leadKEs); 
		
		result = new List<LeadObject>();
		
		For(Lead l : [Select l.Annual_Revenue_Range__c, l.City, l.Company, l.Country, l.FirstName,l.Name, l.Id, l.LastName, l.Score__c, l.Status 
					  from Lead l where l.Id IN : leadIds])
		{
			result.add(new LeadObject(l));
		}
		
		return result;
	}
	
	private static List<String> getLeadIds(List<Lead_Key_Event__c> leadKeyEvents)
	{
		List<String> uniqueIds = new List<String>();
		
		System.debug('Start date : ' + startDate.date().format() + ' End Date : ' + endDate.date().format());
		
		
		Map<String,Lead_Key_Event__c> uniqueLeadsMap = new Map<String , Lead_Key_Event__c>();
		
		For(Lead_Key_Event__c obj : [Select l.Id, l.Lead__c, l.Lead__r.Name , l.Name, l.Lead_Created_Date__c, l.Score__c from Lead_Key_Event__c l
					    			Where l.Lead__c != null And l.Lead_Created_Date__c >= : startDate And l.Lead_Created_Date__c <= : endDate])
	    {
	    	leadKeyEvents.add(obj);
	    	
	    	if(uniqueLeadsMap.get(obj.Lead__c) == null)
	    	{
	    		uniqueLeadsMap.put(obj.Lead__c, obj);
	    		uniqueIds.add(obj.Lead__c);
	    	}
	    }
	    
	    return uniqueIds;
	}
	
	private static void setDates(String startDateString , String startMonthString , String startYearString,
							String endDateString , String endMonthString , String endYearString)
	{
		startDate = Datetime.newInstance(Integer.valueOf(startYearString),Integer.valueOf(startMonthString),Integer.valueOf(startDateString));
		endDate = DateTime.newInstance(Integer.valueOf(endYearString),Integer.valueOf(endMonthString),Integer.valueOf(endDateString));
	}
}

 The code for the flex front end thats calling the webservice menthod getLeads() is as follows:

 

 

package Controller
{
	import Model.Model;
	
	import com.salesforce.AsyncResponder;
	import com.salesforce.Connection;
	import com.salesforce.objects.Parameter;
	import com.salesforce.results.Fault;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;

	public class WebServiceClient
	{
		public var results:ArrayCollection;
		
		public var binding:Connection;
		
		public function WebServiceClient(sfdcConnection:Connection)
		{
			this.binding = sfdcConnection;
			
			if (!this.binding.IsLoggedIn)
				throw new Error("Connection to the server is not available.");	
		}
		
		public function execute(startDate:Date , endDate:Date): void
		{
			Alert.show("executing web service client");
			
			//preparing the parameters of the web service method
			var params : Array = new Array(6);
			
			var stDateStringParam:Parameter = new Parameter("startDateString",startDate.date.toString());
			params[0] = stDateStringParam;
			//params.push(stDateStringParam);
			var stMonthStringParam:Parameter = new Parameter("startMonthString",startDate.month.toString());
			params[1] = stMonthStringParam;
			//params.push(stMonthStringParam);
			var stYearStringParam:Parameter = new Parameter("startYearString",startDate.fullYear.toString());
			params[2] = stYearStringParam;
			//params.push(stYearStringParam);
			var endDateStringParam:Parameter = new Parameter("endDateString",endDate.date.toString());
			params[3] = endDateStringParam;
			//params.push(endDateStringParam);
			var endMonthStringParam:Parameter = new Parameter("endMonthString",endDate.month.toString());
			params[4] = endMonthStringParam;
			//params.push(endMonthStringParam);
			var endYearStringParam:Parameter = new Parameter("endYearString",endDate.fullYear.toString());
			params[5] = endYearStringParam;
			//params.push(endYearStringParam);
			
			getLeads(params);
			
		}
		
		private function getLeads(params:Array):void
		{
			try
			{
			// using SFDC Aysync Responder to get the results in flex
			var tempCallBack: AsyncResponder = new AsyncResponder(
				function(result:Object):void 
				{
					try
					{
						if (result != null)
						{
							var reportsDataController:ReportsDataController = new ReportsDataController();
							reportsDataController.setLeadsData(result);
						}
						else
							Alert.show("Leads are empty.", "Info");
					}
					catch(err:Error)
					{
						Alert.show("error in result handler : " + err.message);
					}
				},
				function(result: Fault):void { Alert.show("Operation failed", "Error");  }
			);
			
			// call the execute method of the SFDC connection object to reach out the web service
			Alert.show("Invokin SOAP");
			binding.execute("MyWebService", "getLeads", params, tempCallBack);
			}
			catch(err:Error)
			{
				Alert.show("error in getLeads : " + err.message);	
			}
		}

	}
}

if I look in the Debug logs , I know i am invoking the webservice and querying for the data , my problem is that the data is not being passed back to flex . i.e. the result object in my asyncresponder is coming back as null.

 

Any help would be greatly appreciated.

 

Thanks 

 

 

 

 

  • September 14, 2010
  • Like
  • 0

Hello everyone,

 

  I am trying to add a simple date picker to my existing visualforce page and/or apex code. Our resource set up a nice grid using apex code and visualforce page, and unfortunately he is no longer around. I am not too familiar with using the code/page so any help would be appreciated! He created a apex code, page, and mycontroller extension. I want to simply add a datepicker so when you click into date field a datepicker pops up. Please let me know how this is done and whether you need the code or the page. I can copy and paste into here. Thanks very much!!

 

Fahd

The application I'm working on involves a large number of pages (many of which update dynamically via AJAX actions) mapped to a small set of controllers. Currently, most combinations of page & state are not bookmark-able. The platform seems to take control of the location in the address bar when you're forwarding to another page of the same controller - query parameters are dropped, and the displayed page name often lags behind what's actually active. Creating a bookmark at such a time will result in an error when you try to load the bookmark - either for required query parameters missing, or the requested page being wrong for the active object's current state. Then, there's the whole issue of bookmarking state that was the result of an AJAX action...

 

One typical solution for this is to use Javascript to load the necessary state into the anchor portion of the address bar's location - that is, the part following the leading '#' char (this does not cause the browser to re-load the page, which is why it's useful). The anchor is saved as part of the bookmark, and then when it's loaded, the application logic can use it to re-instantiate the correct state.

 

That brings us to Visualforce. To fully implement this technique, we need a way to read the anchor string from the controller code so that we can instantiate the correct state, forward to the correct subpage, etc. The PageReference's "getAnchor()" method looked promising, but when I tried it out in a test page "/apex/EchoAnchorTest?foo=bar#foobar" - the call "ApexPages.currentPage().getAnchor()" and "System.currentPageReference().getAnchor()" always returned null. I'm really REALLY hoping for a way to access the "#" part of the current URL in Apex. Is there something I'm missing, or has anyone had luck finding an effective workaround?

 

Mike

The application I'm working on involves a large number of pages (many of which update dynamically via AJAX actions) mapped to a small set of controllers. Currently, most combinations of page & state are not bookmark-able. The platform seems to take control of the location in the address bar when you're forwarding to another page of the same controller - query parameters are dropped, and the displayed page name often lags behind what's actually active. Creating a bookmark at such a time will result in an error when you try to load the bookmark - either for required query parameters missing, or the requested page being wrong for the active object's current state. Then, there's the whole issue of bookmarking state that was the result of an AJAX action...

 

One typical solution for this is to use Javascript to load the necessary state into the anchor portion of the address bar's location - that is, the part following the leading '#' char (this does not cause the browser to re-load the page, which is why it's useful). The anchor is saved as part of the bookmark, and then when it's loaded, the application logic can use it to re-instantiate the correct state.

 

That brings us to Visualforce. To fully implement this technique, we need a way to read the anchor string from the controller code so that we can instantiate the correct state, forward to the correct subpage, etc. The PageReference's "getAnchor()" method looked promising, but when I tried it out in a test page "/apex/EchoAnchorTest?foo=bar#foobar" - the call "ApexPages.currentPage().getAnchor()" and "System.currentPageReference().getAnchor()" always returned null. I'm really REALLY hoping for a way to access the "#" part of the current URL in Apex. Is there something I'm missing, or has anyone had luck finding an effective workaround?

 

Mike

If I return 200 records an put them in a list.

 

If i update 50 of them, what is the best way to perform the update:

 

1. Update the List (which triggers the update context triggers for all 200 records

    

     For(Account[] al : [Select ID, BillingPostalCode From Account Limit 200]){

           For(Account a : al){           

                      if (a.Name.contains('50')){ //Returns only 50 of the 200 records

                             a.BillingPostalCode = 54321;

           }

     update al;

     }

 

2. or keep track of the updated records and only update those 50 (at a cost to heap size)

 

Account[] tbuAcc = New Account[]{};

 

For(Account[] al : [Select ID, BillingPostalCode From Account Limit 200]){

           For(Account a : al){           

                      if (a.Name.contains('50')){ //Returns only 50 of the 200 records

                             a.BillingPostalCode = 54321;

                             tbuAcc.add(a);

           }

     if(tbuAcc.size() >0)

         update tbuAcc;

     }

 

 

Hello,

 I got one error in this program. please solve this problem.

 

My code is:

 

<apex:page id="thepage" sidebar="false" showHeader="false" >


<script language="javascript" type="text/javascript">
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 8;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.getElementById('thepage.randform.randomfield').value = randomstring;
}
</script>


<apex:form id="randform">
<h1><b>Create Random Number</b></h1>
<br/><br/>
<apex:commandButton value="Create Random String" onClick="randomString()" />
<apex:inputText id="randomfield" value="{!randomvalue}"/>
</apex:form>
</apex:page>

I've started to look into Jquery.  So far in all the VF examples I've seen, the Jquery code references standard HTML tags like divs or html input fields.

 

When I've tried to reference apex components (inputField, outputText, etc) by their IDs, nothing happens.  Is this because VF is changing the ID values?  For example, when I inspect the firstName inputField using Firebug, I get this in the ID:

 

<Input id="j_id0:OFLTemplate:j_id11:theBlock:step3:j_id24:firstName" ... >

I am having a love hate relationship with the extensive SFDC documentation.  I love there is sooo much documentation, I hate there is sooo much documentation.  Here is my issue....

 

My boss just walked into my office and said you administer the Accounting solution right??, ok, we need data to get into the accounting system from SFDC. Take care of it. :)

 

Well...I have never used salesforce, apex, and don't know where to start......

 

Here is what I want to do.  I have built a custom object with 10 fields on it. When the user hits save, I need to construct an http post request to a non-sfdc address that contains structured XML for the accounting solution gateway and contains the values of my 10 fields.

 

I was hoping someone could just point me in the right direction where to start.  Any help would be greatly appreciated.

 

Triggers? Apex? Workflow? Outbound message?

 

The Lead object in our org has over 500 custom fields; we got SFDC to extend the custom  field limit.

 

When I try to open the metadata for my Lead object, Eclipse just hangs.  I've waited for over 30 minutes but no joy.  The actual metadata file is over 8 MB.

 

Any suggestions?

 

Mike (Gordy) Gordon

Hi,

 

I am facing an issue while comparing two strings.

Both the strings are same but then on comparion the value returned is False.

There is a line break in both the strings and i suspect that is the reason for the failure.

Here's my code snippet

 

sg.commonField='Percentage of EAL students above National Average 49% of EAL students underachieving in English and 48% in Maths'

 

is.Issue__c= 'Percentage of EAL students above National Average 49% of EAL students underachieving in English and 48% in Maths'

 

if(sg.commonField.equalsignorecase(is.Issue__c))
          {
                      System.debug('inside common** '+is.id);
                         sg.subg.Issues_Smart_Targets__c=is.id;
          } 

 

The if condition returns False.

 

**sg.commonField and is.Issue__c are values from my wrapper class.

 

If the reason for this is line break as i suspected then how do I go about it and resolve the issue?

 

Anyone knows what is the default isolation level and if it is possible to change that? I have a use case as follows: I want to insert a record in an object if it does not exist, otherwise just update it. So I am doing a select (where say name = <some value>), if no record is returned, I create a new one, otherwise I update the existing one. But it appears that if two such calls are executed at the same time, I would end up creating two records (with same name). Anyone knows how to solve this problem?

  • November 21, 2011
  • Like
  • 0

Hi,

 

public void groupAdminEngineBatch(Set<Id> AccountId)
     {    
      List<Contact> contactsList = new List<Contact>([Select Id from Contact where AccountId in : AccountId]);
      for(Contact C : contactsList )
      {
       ContactId.add(C.Id);  
      }
     Query= 'Select Id from user where ContactId  in  '+ContactId+'';
    Database.Query(query);
}

This is Error I got in system debug.

09:43:57.047 (47263000)|SYSTEM_METHOD_ENTRY|[27]|System.debug(ANY)
09:43:57.047 (47309000)|USER_DEBUG|[27]|DEBUG|>>> Test >>>>>> Select Id from user where ContactId  in  (0038000000fVQIUAA4, 0038000000fVRloAAG, 0038000000fVQw3AAG, 0038000000fVQw4AAG, 0038000000fVQw5AAG, 0038000000fVQw6AAG, 0038000000fVRlpAAG, 0038000000fVRlqAAG, 0038000000fVRlrAAG, 0038000000fVSNUAA4, ...) ------ this is Last string created by sfdc if colleaction string is more than 255.
09:43:57.047 (47320000)|SYSTEM_METHOD_EXIT|[27]|System.debug(ANY)
09:43:57.047 (47341000)|SYSTEM_METHOD_ENTRY|[28]|Database.getQueryLocator(String)
09:43:57.047 (47527000)|EXCEPTION_THROWN|[28]|System.QueryException: expecting a right parentheses, found 'fVQIUAA4'
09:43:57.047 (47575000)|SYSTEM_METHOD_EXIT|[28]|Database.getQueryLocator(String)
09:43:57.047 (47645000)|FATAL_ERROR|System.QueryException: expecting a right parentheses, found 'fVQIUAA4'

Seems Query is fine but error is unexpected.


I am getting error seems like dynamic Query not support the IN parameter,if Collection of ID is more than 255.

  • November 21, 2011
  • Like
  • 0

I have an app that does stuff with OpptyTeamMembers, but that app can't be installed in orgs that dont' have it turned on, and I don't want to have to create 2 versions of the app.

 

My solution to this is to make all the opptyTemMember references dynamic using sObjects, but I'm stuck on how to create new records as I get an error trying to do this:

sObject ot=new sObject();

 Error: Type cannot be constructed:sObject

 

I can't simply copy & update an existing opptyTeamMember as the ID fields aren't updatable.  

 

I realize the Apex guide says this isn't possible:

The new operator still requires a concrete sObject type, so all instances are specific sObjects.

 

...but an old thread on the partner API hints that it should be possible:

http://boards.developerforce.com/t5/NET-Development/getting-error-when-using-create-with-the-Partner-wsdl/m-p/27483/highlight/true

I followed this tutorial on drop down lists to the T and I'm still getting "line breaks not allowed in string literals" in my eclipse...http://www.soliantconsulting.com/blog/2009/07/the-user-visualforce-and-apex-about-a-drop-down-menu/

public with sharing class mc_FCCContractNegotiation {

   //==================================================
    // PROPERTIES
    //==================================================
    public mc_Price_Sheet_Code_Entry__c pricesheetCodeEntry {get;private set;}
    public mc_Carrier_Contract_Negotiation__c ContractNeg      {get;private set;}
    public List<mc_CodeEntry>              codeEntries         {get;private set;}
    public List<mc_CodeEntry>              SGcodeEntries         {get;private set;}
    public String                           lookupCode          {get;        set;}
    public ApexPages.StandardSetController  pricesheetEntries   {get;private set;}
    private List Ranks;
    private String Rank;
      



        public mc_FCCContractNegotiation(ApexPages.StandardController controller) {
       	getRank();
       	
        this.ContractNeg = (mc_Carrier_Contract_Negotiation__c)controller.getRecord();
        //codeEntries = mc_CodeEntry.load(contractNeg.id, ContractNeg.getInstance('Standard Charge - Current Year'));
        lookupCode = null;
    }
    
        public PageReference doLoadCodes(){
        SGcodeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, 'a2N400000004CKqEAM');
        codeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, ContractNeg.Code_Price_Sheet__c);
        doSpecifyReimbursementRate();
        
        return null;
    }
    
            public PageReference doSpecifyReimbursementRate(){
            mc_CodeEntry.calculateReimbursementAmount(SGcodeEntries, ContractNeg.Rate__c);
            mc_CodeEntry.calculateReimbursementAmount(codeEntries, ContractNeg.Rate__c);
        return null;
    }
    
   	    public String getRank(){
			return this.Rank;
    	}
    	
    }
    	public List getRanks() {
  			List Ranks= new List();
  			Ranks.add(new SelectOption('00','Selection'));
  			Ranks.add(new SelectOption('ED','ED'));
  			Ranks.add(new SelectOption(’MC’,'MC’));
  			Ranks.add(new SelectOption(’HM’,'HM’));
  			Ranks.add(new SelectOption(’UC’,'UC’));

  			return Ranks;
	}
    
    	public String getRank(){
  			int val=0;
  			if(Rank == ‘ED’){
    				val = 1;
  				}else{
  		  			if(Rank == ‘MC’){
    						val = 2;
  			 			}else{
  			   				if(Rank == ‘HM’){
    		          				val = 3;
  			       				}else{
  			       	 				if(Rank == ‘UC’){
    				        				val = 4;
  			       	 				}
  			   				}
  		  			}
  			}
    	
  	
  		
  	return Rank;
	}
    
}

 

Any ideas?

Hi!  

 

When actionSupport component rerender other visualforce components, scrollbar page is reset to top but I would  like to keep position of page.  Any solution?

 

Thanks in advance.

can someone please explain to me how this code is conerting String to word. I would apprecite you rhelp.Thanks

 

//Takes a Number as a String, and makes it into the word number.
public String toWords(String s){
    String[] th = new String[]{'','thousand','million', 'billion','trillion'};
    String[] dg = new String[]{'zero','one','two','three','four', 'five','six','seven','eight','nine'};
    String[] tn = new String[]{'ten','eleven','twelve','thirteen', 'fourteen','fifteen','sixteen', 'seventeen','eighteen','nineteen'};
    String[] tw = new String[]{'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety'};
   
    s = s.replace(',','');
        Integer x = 0;
        x = s.indexOf('.');
        if (x == -1) x = s.length();
        if (x > 15) return 'too big';
        String[] qr = s.split('');
        Integer[] n = new Integer[0];
        for (Integer i=1;i < qr.size();i++){
            n.add(Integer.valueOf(qr[i]));
        }
        String str = '';
        Integer sk = 0;
        for (Integer i=0; i < x; i++) {
            if (math.mod(x-i,3)==2){
                if (n[i] == 1) {
                    str += tn[n[i+1]] + ' ';
                    i++; sk=1;
                }
                else if (n[i]!=0) {
                    str += tw[n[i]-2] + ' ';
                    sk=1;
                }
            }
            else if (n[i]!=0) {
                str += dg[n[i]] +' ';
                if(math.mod(x-i,3)==0) str += 'hundred ';
                sk=1;
            }
            if(math.mod(x-i,3)==1){
                if (sk==1) str += th[(x-i-1)/3] + ' ';
                sk=0;
            }
        }
        if (x != s.length()) {
            Integer y = s.length();
            str += 'point ';
            for (Integer i=x+1; i<y; i++) str += dg[n[i]] +' ';
        }
        return str;
       
}

 




Hi,

 

I've one requirement regarding dynamic Apex.

I've one string which contains the sObject API name.

 

Task 1: To determine if such object exists in my org or not.

Task 2: If it does exists in the org, I want to create its record dynamically.

 

I m done with task 1, but now, i am not able to create the record. Does any one knows how to create a record of the object whose API name is with you in string format.

 

Note : In step one i am able to get the Token for the object.

 

For Task 1 i ve following code snippet

 

 

  1.     public void retrieveObjectName(){
    1.         String strObjectName = 'Account';
    2.         Map<String, Schema.Sobjecttype> SobjectMap = Schema.getGlobalDescribe();
    3.         Schema.Sobjecttype sObjectToken = SobjectMap.get(strObjectName);
    4.         if(sObjectToken <> NULL)
    5.         System.debug('sObjectToken ' + sObjectToken);
    6.         else
    7.         System.debug('No Such Object Exists ');
    8.         Account obj = (Account)sObjectToken.newSObject();
    9.         insert obj;
        }

At line number 8, i've hardcoded 'Account'. But in my requirement this can be any existing object in my org.

I have a page with 5 data entry sections each of which is tied to a specific record type of the object. I would like to only show the one section that applies to the record type that was selected when creating the record. I found the references and code samples for the rendered attribute, but just can't seem to get the syntax correct. The code below is my latest attempt, but it won't save. The error is "Incorrect parameter for operator '='. Expected Object, received Text"

 

<apex:pageBlockSection title="Fee Waiver RME" rendered="{!RME__c.RecordType='012S00000000Pvm'}">

 

Any help would be appreciated.

Are apex apss single threaded in general, I'm not talking about future call.

 

 

Is there a constant for Pi that I just cant find? Its easy enough to define a Double with a pre-defined value in it, but I would assume that there was something in Math for it.