• NaypersMclgx
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies

Hi everyone!

 

I hope somebody can help me, I'd like to cover this function but I can't get it (not even a line)

 

Do you now what's going on?..  thanks for your time..

 

public with sharing class MyController {

	public List<SelectOption> getGenerateOptions(String value){
			
		value = (value == null) ? '' : value;
			
			List<SelectOption> elements = new List<SelectOption>();
			elements.add(new SelectOption(value, value));
			elements.add(new SelectOption('', '----'));
			
			for(Integer i=0; i < 11; i++){ 
				elements.add(new SelectOption('' + i, '' + i)); 
			}
			
			return elements;
		}

	// ...
}
	
 
static testmethod void myTest(){
	MyController test = new MyController();
	test.getGenerateOptions('5');
	
	// ...
}

 

 

 

hi everyone, I hope somebody can helpme, I try to have options in a selectlist that depends on another, I have this but I dont know what's wrong

 

VISUAL FORCE

 

<apex:page controller="myController" >
    <apex:form >
    
        <apex:selectList id="selectlist1" value="{!select1}" size="1">
            <apex:actionSupport event="onclick" reRender="selectlist2"/>
            <apex:selectOptions value="{!items}"/>    
        </apex:selectList>
         
        <apex:selectList id="selectlist2" value="{!select2}" size="1">
            <apex:selectOptions value="{!items2}"/>    
        </apex:selectList>
        
    </apex:form>
</apex:page>

APEX CODE

 

public class myController {

    public string select1{get; set;}
    public string select2{get; set;}

    public List<SelectOption> getItems()
    {
        List<SelectOption> option = new List<SelectOption>(); 
            option.add(new SelectOption('op1','Option 1'));
            option.add(new SelectOption('op2','Option 2'));
            option.add(new SelectOption('op3','Option 3'));
        return option;
    }
 
    public List<SelectOption> getItems2()
    {
        List<SelectOption> option = new List<SelectOption>();
        if( select1 == 'op3')
            {
                option.add(new SelectOption('op3_1','Option 3.1'));
                option.add(new SelectOption('op3_2','Option 3.2'));
                option.add(new SelectOption('op3_3','Option 3.3'));
            }
        return option;
    }
 
}

 

Hi everyone!!!, I hope someone can help me with this challenge.

This is the situation...

 

 

So, I did something like this...

 

VISUALFORCE

 

<apex:page controller="myController">

    <apex:form >
        <apex:selectList id="rangeDates" value="{!selection}" size="1">
                <apex:actionSupport event="onclick" action="{!changeDates}" />
                <apex:actionSupport event="onclick" reRender="closeDateStart"/>
                <apex:actionSupport event="onclick" reRender="closeDateEnd"/>
                <apex:selectOptions value="{!items}"/>    
        </apex:selectList>
        
        <br /><br /><br /><br />
        
        <apex:inputField id="closeDateStart" value="{!start.closeDate}" />
        <apex:inputField id="closeDateEnd" value="{!end.closeDate}" />
    </apex:form>

</apex:page>

 

 

APEX CODE

 

public with sharing class myController{

    Public string selection{get; set;}
    Opportunity closeDateStart = new Opportunity();
    Opportunity closeDateEnd = new Opportunity();

        public Opportunity getStart(){ 
	    return closeDateStart; 
	}
		
        public Opportunity getEnd(){
	    return closeDateEnd;
	}
        
        public List<SelectOption> getItems(){
            List<SelectOption> optionsDate = new List<SelectOption>(); 
	    optionsDate.add(new SelectOption('null','Select Range'));
            optionsDate.add(new SelectOption('Year','This Year'));
            return optionsDate;
        }

        public void changeDates(){
            if(selection == 'Year'){
                closeDateStart.closeDate = date.newInstance(2012, 1, 1);
                closeDateEnd.closeDate = date.newInstance(2010, 12, 31);            
            }
        }
}

 

But, we have a problem...

 

 

 

What could be the problem??

 

 

Thanks for your time!

Hello everyone, I hope someone can help me,

I have an app with aloha status and it's very common to see the next error when a the user is using a group edition:

System.LimitException: ranktab:Too many SOQL queries: 101
An unexpected error has occurred. Your solution provider has been notified.

So, I'd like to know what are the limitations of this version (group edition).

Mainly the maximum number of results (SOQL) that I could get.

Thank you.

 

Hi guys..  I hope someone can help me. I'm trying to use a inputField Calendar in a VF page, the problem is I using a controller, any ideas?

 

 

field calendar

 

This is the calendar that I'd like to have in my VF page.

 

THANK YOU...

Hi!, I'd like to know if is possible to have a function in a pageBlockTable that return something to print in a column, I would also like to add a parameter in this function like the example. Anyone know if this can be done, and how?,

 

thank you!.

 

function in a pageBlockTable

 

My code:

 

<apex:page sidebar="true" controller="ListOpportunities"> 
    <apex:outputPanel rendered="{!showOpportunities}">
        <apex:form >
            <apex:pageBlock title="{!userName} Opportunities">

                <apex:pageBlockTable value="{!myObjectOpportunities}" var="opp">
				
                    <apex:column headerValue="Name" >
                        <apex:outputText value="{!opp.name}" />
                    </apex:column> 
                    
                    <apex:column headerValue="Amount" >
                        <apex:outputText value="{!opp.amount}" />
                    </apex:column> 
					
		    <apex:column headerValue="stageName" >
                        <apex:outputText value="{!opp.stageName}" />
                    </apex:column> 
                    
		    <apex:column headerValue="Id" >
                        <apex:outputText value="{!opp.id}" />
                    </apex:column> 
					
 <apex:column headerValue="Custom Field" > <apex:outputText value="validateOpp(opp.id)" /> </apex:column> 

                </apex:pageBlockTable> 
            </apex:pageBlock>
        </apex:form>
    </apex:outputPanel>
</apex:page>

 

Hi, I hope somebody can help me.

 

I need to add an account column in a Oportunnity table, I'm  using a pageBlockTable that receive a list (List<Opportunity>), and I'm using a Controller.

 

I have this in my controller...

 

// CONTROLLER

 public Opportunity[] getMyObjectOpportunities() {
        
        String sortFullExp = sortExpression  + ' ' + sortDirection;
        List<Opportunity> itemsOpportunities;

            String sqlFilter = '';
                
            sqlFilter += ' SELECT Name, ';
            sqlFilter += ' stageName, '; 
            sqlFilter += ' closeDate, '; 
            sqlFilter += ' Id, ';  
            sqlFilter += ' Probability, ';  
            sqlFilter += ' Amount '; 
            sqlFilter += ' FROM Opportunity WHERE CreatedById = \'' + getUserId() + '\'';
            sqlFilter += ' ORDER BY ' + sortFullExp + ' LIMIT 1000';

            itemsOpportunities = DataBase.query(sqlFilter);

        return itemsOpportunities ;
}

 

Thak you.

Hi everyone!!!, I hope someone can help me with this challenge.

This is the situation...

 

 

So, I did something like this...

 

VISUALFORCE

 

<apex:page controller="myController">

    <apex:form >
        <apex:selectList id="rangeDates" value="{!selection}" size="1">
                <apex:actionSupport event="onclick" action="{!changeDates}" />
                <apex:actionSupport event="onclick" reRender="closeDateStart"/>
                <apex:actionSupport event="onclick" reRender="closeDateEnd"/>
                <apex:selectOptions value="{!items}"/>    
        </apex:selectList>
        
        <br /><br /><br /><br />
        
        <apex:inputField id="closeDateStart" value="{!start.closeDate}" />
        <apex:inputField id="closeDateEnd" value="{!end.closeDate}" />
    </apex:form>

</apex:page>

 

 

APEX CODE

 

public with sharing class myController{

    Public string selection{get; set;}
    Opportunity closeDateStart = new Opportunity();
    Opportunity closeDateEnd = new Opportunity();

        public Opportunity getStart(){ 
	    return closeDateStart; 
	}
		
        public Opportunity getEnd(){
	    return closeDateEnd;
	}
        
        public List<SelectOption> getItems(){
            List<SelectOption> optionsDate = new List<SelectOption>(); 
	    optionsDate.add(new SelectOption('null','Select Range'));
            optionsDate.add(new SelectOption('Year','This Year'));
            return optionsDate;
        }

        public void changeDates(){
            if(selection == 'Year'){
                closeDateStart.closeDate = date.newInstance(2012, 1, 1);
                closeDateEnd.closeDate = date.newInstance(2010, 12, 31);            
            }
        }
}

 

But, we have a problem...

 

 

 

What could be the problem??

 

 

Thanks for your time!

Hi!, I hope someone can help me.

 

I'm creating a function to check if I have a record in a SOQL table, I using a custom object, my app will need a 'Default' record to work, if this record doesn't exist, I'd like to create it from here.

 

I have something like this, but this function doesn't create the record and I dont know why.

 

    public void checkDefault(){

        try{ 
        
	// If is possible to do this, it means I have a record 'Default'.
        customObject__c obj = [ SELECT Concept1__c,Concept2__c,Concept3__c,Concept4__c  FROM customObject__c WHERE name='Default' LIMIT 1 ];
        update obj;  

        } 
		
	// If I don't have it... create it.
         catch(Exception ex){ 

             customObject__c obj = new customObject__c(
                name='Default',
                Concept1__c = ' Text ',
                Concept2__c = ' Text ',
                Concept3__c = ' Text ',
                Concept4__c = ' Text ');
        }
            
    }

 

Please help!

 

Hi guys..  I hope someone can help me. I'm trying to use a inputField Calendar in a VF page, the problem is I using a controller, any ideas?

 

 

field calendar

 

This is the calendar that I'd like to have in my VF page.

 

THANK YOU...

Hi, I hope somebody can help me.

 

I need to add an account column in a Oportunnity table, I'm  using a pageBlockTable that receive a list (List<Opportunity>), and I'm using a Controller.

 

I have this in my controller...

 

// CONTROLLER

 public Opportunity[] getMyObjectOpportunities() {
        
        String sortFullExp = sortExpression  + ' ' + sortDirection;
        List<Opportunity> itemsOpportunities;

            String sqlFilter = '';
                
            sqlFilter += ' SELECT Name, ';
            sqlFilter += ' stageName, '; 
            sqlFilter += ' closeDate, '; 
            sqlFilter += ' Id, ';  
            sqlFilter += ' Probability, ';  
            sqlFilter += ' Amount '; 
            sqlFilter += ' FROM Opportunity WHERE CreatedById = \'' + getUserId() + '\'';
            sqlFilter += ' ORDER BY ' + sortFullExp + ' LIMIT 1000';

            itemsOpportunities = DataBase.query(sqlFilter);

        return itemsOpportunities ;
}

 

Thak you.

Hi,

I'm new to salesforce, APEX and SOQL. I want to know, how can we update some record using SOQL in APEX code?