• Hari nadh babu Eluru 7
  • NEWBIE
  • 80 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies
VF code Page1
<apex:page controller="M_R_Another">
<apex:form >
<apex:pageBlock title="Recently Modified">
<apex:commandButton value="Click Me" action="{!RM}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex code Page 1
public class M_R_Another {

    public PageReference RM() {
        PageReference pageRef = new PageReference('https://93com4-dev-ed--c.visualforce.com/apex/M_R_Another2?mrp='+RM);
        return pageRef;
    }

}
VF Code Page 2
<apex:page controller="M_R_Another2">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!n}" var="g">
                <apex:column value="{!g.Name}"/>
                <apex:column value="{!g.LastModifiedDate}"/>
                <apex:column value="{!g.Student_Id__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex code Page 2
public class M_R_Another2 {

    public list<Student__c> n { get; set; }
    
    public M_R_Another2(){
        string m = ApexPages.currentPage().getParameters().get('mrp');
        n = [SELECT Student_Id__c,Name, LastModifiedDate FROM Student__c  ORDER BY LastModifiedDate DESC];
    }
}
And also getting Error below image is the error getting in page 1
error



 
take a picklist which is having options male,female,others. if user select male and click button then show male students only in vf page
 
<apex:page controller="ChooseGender">
<apex:form >
    <apex:selectList id="ChooseGender" value="{!CG}" size="1">
            <apex:selectOption itemValue="Male" itemLabel="Male"/>
            <apex:selectOption itemValue="Female" itemLabel="Female"/>
            <apex:selectOption itemValue="Others" itemLabel="Others"/>
        </apex:selectList> 
<apex:commandButton value="Click me" action="{!PSO}"/>
</apex:form>
</apex:page>

 
VF code
<apex:page controller="Created_Recently">
    <apex:form >
        <apex:pageblock title="Recently Modified student">
          
            <apex:pageBlockTable value="{!stu}" var="c">
                <apex:column value="{!c.Name}"/>
                <apex:column value="{!c.LastModifiedDate}"/>
                <apex:column value="{!c.Student_Id__c}"/>
            </apex:pageBlockTable>
        </apex:pageblock>        
    </apex:form>
</apex:page>
Apex code
public class Created_Recently {
    
    public List<Student__c> stu {get;set;}
 
    public Created_Recently(){
        DateTime dt = System.Now().addHours(-1);
        stu = [SELECT Student_Id__c,Name, LastModifiedDate FROM Student__c where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1];
        system.debug('stu'+stu);
        
    }
}

fetch and display students whose records modified recently
in visualforce page
In search box if user enter a letter 's' then bring students name starts with s. In visualforce
fetch and display students whose records modified recently in visualforce page

If user enter min age, max age . fetch all the students in between that min and max age

  • in above example try to load students in ascending order based on age

 
Date myOldDate = Date.newInstance(2021, 1, 1);
Date myTodayDate = date.today();
List<Student__c>studentList = new List <Student__c>();
studentList = [SELECT Student_Id__c, Name, Joining_Date__c FROM Student__c
              WHERE Joining_Date__c >: myOldDate AND Joining_Date__c :<= myTodayDate];
In this above code i had getting this below error
Error Message
The error is appeared at in "studentList =" on here at in equalto symbol. Please resolve my problem. Thank you !
write the apex class to define diagonal length of rectangle formula to substitute values formula is
diagonal length of rectangle formula
In search box if user enter a letter 's' then bring students name starts with s. In visualforce
fetch and display students whose records modified recently in visualforce page

If user enter min age, max age . fetch all the students in between that min and max age

  • in above example try to load students in ascending order based on age

 
write the apex class to define diagonal length of rectangle formula to substitute values formula is
diagonal length of rectangle formula