You need to sign in to do that
Don't have an account?

Argument cannot be null
hai hall i wrote a code but it throws an error
public class inlinewrapper {
public string startdate{set;get;}
public opportunity opps{set;get;}
}
public class inappps {
public list<opportunity>apps{set;get;}
public inlinewrapper linewrapper{set;get;}
public decimal yeargap{set;get;}
public inappps(){
apps=[select id, name,CreatedDate ,closedate from opportunity];
for(opportunity os:apps){
linewrapper=new inlinewrapper();
linewrapper.startdate= string.valueof(os.CreatedDate);
linewrapper.opps=os;
}
}
public void caluclation( ){
linewrapper=new inlinewrapper();
datetime dt1= datetime.valueof(linewrapper.startdate);
date convertation=date.newinstance(dT1.year(), dT1.month(), dT1.day());
date close=linewrapper.opps.closedate;
yeargap=(convertation.monthsBetween(close));
}
}
<apex:page controller="inappps" docType="html-5.0">
<apex:form >
<apex:pageblock >
<apex:pageblockbuttons location="top">
<apex:commandbutton value="show" action="{!caluclation}"/>
</apex:pageblockbuttons>
<apex:pageblocktable value="{!linewrapper}" var="s">
<apex:column >
Date: <apex:inputText value="{!s.startdate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this ,true);" />
</apex:column>
<apex:column headerValue="closedate">
<apex:outputfield value="{!s.opps.closedate}">
<apex:inlineeditsupport event="ondblclick"/>
</apex:outputfield>
</apex:column>
</apex:pageblocktable>
{!yeargap}
</apex:pageblock>
</apex:form>
</apex:page>
public class inlinewrapper {
public string startdate{set;get;}
public opportunity opps{set;get;}
}
public class inappps {
public list<opportunity>apps{set;get;}
public inlinewrapper linewrapper{set;get;}
public decimal yeargap{set;get;}
public inappps(){
apps=[select id, name,CreatedDate ,closedate from opportunity];
for(opportunity os:apps){
linewrapper=new inlinewrapper();
linewrapper.startdate= string.valueof(os.CreatedDate);
linewrapper.opps=os;
}
}
public void caluclation( ){
linewrapper=new inlinewrapper();
datetime dt1= datetime.valueof(linewrapper.startdate);
date convertation=date.newinstance(dT1.year(), dT1.month(), dT1.day());
date close=linewrapper.opps.closedate;
yeargap=(convertation.monthsBetween(close));
}
}
<apex:page controller="inappps" docType="html-5.0">
<apex:form >
<apex:pageblock >
<apex:pageblockbuttons location="top">
<apex:commandbutton value="show" action="{!caluclation}"/>
</apex:pageblockbuttons>
<apex:pageblocktable value="{!linewrapper}" var="s">
<apex:column >
Date: <apex:inputText value="{!s.startdate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this ,true);" />
</apex:column>
<apex:column headerValue="closedate">
<apex:outputfield value="{!s.opps.closedate}">
<apex:inlineeditsupport event="ondblclick"/>
</apex:outputfield>
</apex:column>
</apex:pageblocktable>
{!yeargap}
</apex:pageblock>
</apex:form>
</apex:page>
Which line it;s getting .
Regards ,
Harish.R