-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
35Questions
-
13Replies
Create Campaign in Pardot which will send out an email and Tack If user have Opened it.
I need to build a Campaign in Salesforce Marketing Application called Pardot, Where we need to create a Campaign which will send out an email with a webinar link to the list of users and we need to track if the users have accessed the links? and I need to send three emails with 3 different link and track the activity by user.
I am new in Marketing cloud. Could you please help me for this task.
Thank you in advance.
I am new in Marketing cloud. Could you please help me for this task.
Thank you in advance.
-
- Radhika pawar 5
- January 18, 2019
- Like
- 0
- Continue reading or reply
How to write Test Class for Before insert/update Trigger
Hey Friends,
I am new in salesforce,
I am Stuck on writting test class for Trigger .
Below my Code:
trigger add_questions_balwadi_batch on UP_Batch__c (before insert, before update)
{
List<UP_Question__c> piq = [Select id,Name from UP_Question__c];
for(UP_Batch__c upb : trigger.new)
{
if(upb.Program__c == 'Balwadi')
{
upb.Q_1__c = piq[0].id;
upb.Q_2__c = piq[1].id;
upb.Q_3__c = piq[19].id;
upb.Q_4__c = piq[2].id;
upb.Q_5__c = piq[5].id;
upb.Q_6__c = piq[12].id;
upb.Q_7__c = piq[6].id;
upb.Q_8__c = piq[15].id;
upb.Q_9__c = piq[3].id;
upb.Q_10__c = piq[14].id;
upb.Q_11__c = piq[11].id;
upb.Q_12__c = piq[10].id;
upb.Q_13__c = piq[9].id;
upb.Q_14__c = piq[13].id;
upb.Q_15__c = piq[17].id;
upb.Q_16__c = piq[18].id;
upb.Q_17__c = piq[8].id;
upb.Q_18__c = piq[16].id;
upb.Q_19__c = piq[7].id;
upb.Q_20__c = piq[4].id;
}
}
}
I am new in salesforce,
I am Stuck on writting test class for Trigger .
Below my Code:
trigger add_questions_balwadi_batch on UP_Batch__c (before insert, before update)
{
List<UP_Question__c> piq = [Select id,Name from UP_Question__c];
for(UP_Batch__c upb : trigger.new)
{
if(upb.Program__c == 'Balwadi')
{
upb.Q_1__c = piq[0].id;
upb.Q_2__c = piq[1].id;
upb.Q_3__c = piq[19].id;
upb.Q_4__c = piq[2].id;
upb.Q_5__c = piq[5].id;
upb.Q_6__c = piq[12].id;
upb.Q_7__c = piq[6].id;
upb.Q_8__c = piq[15].id;
upb.Q_9__c = piq[3].id;
upb.Q_10__c = piq[14].id;
upb.Q_11__c = piq[11].id;
upb.Q_12__c = piq[10].id;
upb.Q_13__c = piq[9].id;
upb.Q_14__c = piq[13].id;
upb.Q_15__c = piq[17].id;
upb.Q_16__c = piq[18].id;
upb.Q_17__c = piq[8].id;
upb.Q_18__c = piq[16].id;
upb.Q_19__c = piq[7].id;
upb.Q_20__c = piq[4].id;
}
}
}
-
- Radhika pawar 5
- January 22, 2015
- Like
- 0
- Continue reading or reply
How to retrives the Lookupdata using List
Hey Friends,
I have One Issused which i m facing saved the Multipicklist value present in UP_Library_book__c Object Name
I m using Three Object
Name like :
1)UP_Library_book__c
2)UP_Book_Assignment__c
3)student__c
Relation ship are :
I m doing:
But after saving :It will showing
Its not saved Multi picklist value
My code:
public with sharing class testctrlUPLBAssig{
public UP_Batch__c Batch{get;set;}
private final UP_Batch__c Batchc;
private List<Student> lstStudents;
private List<UP_Library_book__c> lstBooks;
public List<SelectOption> book_options{get;set;}
public testctrlUPLBAssig(ApexPages.StandardController controller) {
Batchc = (UP_Batch__c)controller.getRecord();
book_options = new List<SelectOption>();
lstStudents = new List<Student>();
if(this.Batchc.Id != null) {
Batch = [SELECT Id, Name, Address__c, program__c, Academic_Year__c, Start_date__c, community__r.Name, community__c from UP_Batch__c where Id=: this.Batchc.Id];
LoadExistingTask();
}
}
private void LoadExistingTask() {
lststudents.clear();
book_options.clear();
List<up_student__c> tempstu = [Select id, Contact__r.Name from up_student__c where Batch__c =: this.batch.id Order by CreatedDate];
List <UP_Library_book__c>temp_book = [SELECT id, Age_Group__c, community__c, title__c FROM UP_Library_book__c WHERE community__c =: batch.community__c order by title__c];
Map<id, UP_Library_book__c> mbook = new map<id, UP_Library_book__c>();
for(UP_Library_book__c temp : temp_book) {
mbook.put(temp.id, temp);
}
List<UP_Book_Assignment__c> temp_assign = [SELECT Book__c FROM UP_Book_Assignment__c WHERE returned__c = false and student__c =: tempstu];
temp_assign = [SELECT Issued_Month__c,Student__c,Book__c,Book__r.Book_List__c,Book__r.Title__c FROM UP_Book_Assignment__c WHERE student__c =: tempstu order by createddate desc];
Map<id, List<UP_Book_Assignment__c>> massign = new Map<id, List<UP_Book_Assignment__c>>();
List<UP_Book_Assignment__c> swap;
for(UP_Book_Assignment__c temp : temp_assign) {
swap = massign.get(temp.student__c);
if (swap == null) {
swap = new List<UP_Book_Assignment__c>();
}
swap.add(temp);
massign.put(temp.student__c, swap);
}
for(up_student__c stu : tempstu) {
lststudents.add(new student(stu, massign.get(stu.id)));
}
}
public pageReference Save() {
List<UP_Book_Assignment__c> lst_assign = new List<UP_Book_Assignment__c>();
try {
for (Student st : lstStudents) {
for(UP_Book_Assignment__c temp : st.assign) {
lst_assign.add(temp);
}
}
upsert lst_assign;
}
catch(DmlException ex) {
ApexPages.addMessages(ex);
return null;
}
PageReference prPage;
prPage = new PageReference('/apex/up_l_assignment?id=' + this.Batchc.Id);
prPage.setRedirect(true);
return prPage;
}
public List<Student> getOppTask() {
return lstStudents;
}
public class Student {
public List<UP_Book_Assignment__c> assign {get;set;}
public UP_Student__c stu {get;set;}
public Student(UP_student__c student, List<UP_Book_Assignment__c> assign) {
this.stu = student;
if (assign == null)
assign = new List<UP_Book_Assignment__c>();
this.assign = assign;
}
public PageReference addStudentPlacement() {
this.assign.add(new UP_Book_Assignment__c(student__c = this.stu.id));
return null;
}
}
}
I have One Issused which i m facing saved the Multipicklist value present in UP_Library_book__c Object Name
I m using Three Object
Name like :
1)UP_Library_book__c
2)UP_Book_Assignment__c
3)student__c
Relation ship are :
I m doing:
But after saving :It will showing
Its not saved Multi picklist value
My code:
public with sharing class testctrlUPLBAssig{
public UP_Batch__c Batch{get;set;}
private final UP_Batch__c Batchc;
private List<Student> lstStudents;
private List<UP_Library_book__c> lstBooks;
public List<SelectOption> book_options{get;set;}
public testctrlUPLBAssig(ApexPages.StandardController controller) {
Batchc = (UP_Batch__c)controller.getRecord();
book_options = new List<SelectOption>();
lstStudents = new List<Student>();
if(this.Batchc.Id != null) {
Batch = [SELECT Id, Name, Address__c, program__c, Academic_Year__c, Start_date__c, community__r.Name, community__c from UP_Batch__c where Id=: this.Batchc.Id];
LoadExistingTask();
}
}
private void LoadExistingTask() {
lststudents.clear();
book_options.clear();
List<up_student__c> tempstu = [Select id, Contact__r.Name from up_student__c where Batch__c =: this.batch.id Order by CreatedDate];
List <UP_Library_book__c>temp_book = [SELECT id, Age_Group__c, community__c, title__c FROM UP_Library_book__c WHERE community__c =: batch.community__c order by title__c];
Map<id, UP_Library_book__c> mbook = new map<id, UP_Library_book__c>();
for(UP_Library_book__c temp : temp_book) {
mbook.put(temp.id, temp);
}
List<UP_Book_Assignment__c> temp_assign = [SELECT Book__c FROM UP_Book_Assignment__c WHERE returned__c = false and student__c =: tempstu];
temp_assign = [SELECT Issued_Month__c,Student__c,Book__c,Book__r.Book_List__c,Book__r.Title__c FROM UP_Book_Assignment__c WHERE student__c =: tempstu order by createddate desc];
Map<id, List<UP_Book_Assignment__c>> massign = new Map<id, List<UP_Book_Assignment__c>>();
List<UP_Book_Assignment__c> swap;
for(UP_Book_Assignment__c temp : temp_assign) {
swap = massign.get(temp.student__c);
if (swap == null) {
swap = new List<UP_Book_Assignment__c>();
}
swap.add(temp);
massign.put(temp.student__c, swap);
}
for(up_student__c stu : tempstu) {
lststudents.add(new student(stu, massign.get(stu.id)));
}
}
public pageReference Save() {
List<UP_Book_Assignment__c> lst_assign = new List<UP_Book_Assignment__c>();
try {
for (Student st : lstStudents) {
for(UP_Book_Assignment__c temp : st.assign) {
lst_assign.add(temp);
}
}
upsert lst_assign;
}
catch(DmlException ex) {
ApexPages.addMessages(ex);
return null;
}
PageReference prPage;
prPage = new PageReference('/apex/up_l_assignment?id=' + this.Batchc.Id);
prPage.setRedirect(true);
return prPage;
}
public List<Student> getOppTask() {
return lstStudents;
}
public class Student {
public List<UP_Book_Assignment__c> assign {get;set;}
public UP_Student__c stu {get;set;}
public Student(UP_student__c student, List<UP_Book_Assignment__c> assign) {
this.stu = student;
if (assign == null)
assign = new List<UP_Book_Assignment__c>();
this.assign = assign;
}
public PageReference addStudentPlacement() {
this.assign.add(new UP_Book_Assignment__c(student__c = this.stu.id));
return null;
}
}
}
-
- Radhika pawar 5
- January 09, 2015
- Like
- 0
- Continue reading or reply
I am done with the Freeze header and Column of a table using Jquery but width problem facing in <apex:repeat> value
Hey Friends,
Please giude me for fixing the width of <apex:repeat> Data .
In this output value :attendace value(P & A) exact comes but the problem comes in data header its comes only 1 month date ,
Please guide me .

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css"/>
<link rel="stylesheet" type="text/css" href="/css/result-light.css"/>
<style type='text/css'>
#container { margin: 10px; overflow: hidden; }
.relativeContainer { position: relative; width: auto; height: 400px; overflow: hidden; border: 1px solid green; }
td { background-color: white; padding: 2px; }
.fixedTB { position: absolute; left: 0px; top: 0px; z-index: 11; right:100px; }
.leftContainer { position: absolute; left: 0px; top: 52px; height: 350px; overflow: hidden; }
.rightContainer { position: absolute; left: 165px; top: 0px; width: auto; overflow: hidden; }
.leftSBWrapper { position: relative; left: 0px; top: 0px; z-index: 10; }
.topSBWrapper { position: relative; left: 0px; top: 0px; z-index: 10; }
.SBWrapper { width: 1100px; height: 250px; overflow: auto; }
</style>
<style>
#disp
{
font-family:garmond;
font-size:13px;
font-weight:bold
}
</style>
<script type="text/javascript">
function att(){
afatt();
}
</script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/excite-bike/jquery-ui.css"/>
<!-- Begin Default Content REMOVE THIS -->
<table border="0" width="100%">
<tr>
<td width="32%" align="left" style="padding-left:3px;"><apex:image url="{!$Resource.Pratham_logo}" height="58" width="350" /></td>
<td align="center"> <font size="5" face="calibri"><b><font face="candara" color="#019dd6">Pratham Institute - Student Attendance</font></b></font></td>
<td align="right" width="33%" style="padding-right:15px;"><apex:image url="{!$Resource.PACE_logo}" height="55" width="250" /></td>
</tr></table>
<apex:form id="frm">
<script type='text/javascript'>
$(window).load(function(){
$(function () {
$('.SBWrapper').scroll(function () {
var rc = $(this).closest('.relativeContainer');
var lfW = rc.find('.leftSBWrapper');
var tpW = rc.find('.topSBWrapper');
lfW.css('top', ($(this).scrollTop()*-1));
tpW.css('left', ($(this).scrollLeft()*-1));
});
});
});
</script>
<apex:actionFunction name="afsaveOnly" action="{!SaveOnly}" status="addRowStatus1" reRender="frm"/>
<apex:actionFunction name="afcancel" action="{!Cancel}" status="addRowStatus1" reRender="frm"/>
<apex:pageMessages />
<apex:pageBlock title="Students Attendance">
<apex:outputPanel >
<div id="container">
<div class="relativeContainer">
<!-- Fixed Column for both scroller -->
<div class="fixedTB">
<table border="1" width="164px" cellspacing="1" cellpadding="0" height="52px" >
<tr>
<td width="40px">Roll No.</td>
<td width="50px"> Student Name</td>
<td width="40px">Biometric Id</td>
</tr>
</table>
</div>
<div class="leftContainer">
<!-- Fixed Column for horz scroller -->
<div class="leftSBWrapper">
<table border="1" width="100px" cellspacing="1" cellpadding="0">
<apex:repeat value="{!oppTask}" var="stu">
<tr>
<td width="100px" height="50px"><apex:outputText value="{!stu.St.Student_Id__c}"/> </td>
<td width="80px" height="50px">
<apex:outputText value="{!stu.st.First_name__c} {!stu.st.Middle_name__c}
{!stu.st.Last_name__c}"/>
</td>
<td width="80px">
<apex:outputText value="{!stu.st.Biometric_Id__c}"/>
</td>
</tr></apex:repeat>
</table>
</div>
</div>
<div class="rightContainer">
<div class="topSBWrapper">
<table border="1" width="1400px" cellspacing="1" cellpadding="0" align="center">
<tr>
<apex:repeat value="{!attdates}" var="cur_date">
<td><apex:outputText value="{0,date,dd'/'MM}">
<apex:param value="{!cur_date}" />
</apex:outputText>
<!-- <apex:outputText value="{0, date, d MMM yyyy}"> <apex:param value="{!cur_date}" /> </apex:outputText>--> </td>
</apex:repeat>
<td><apex:outputText value="Total Attendance out of {!No_of_days}"/></td>
</tr>
</table>
</div>
<div class="SBWrapper">
<table border="1" width="1100px" cellspacing="1" cellpadding="0" align="center" >
<apex:repeat value="{!oppTask}" var="stu">
<tr>
<apex:repeat value="{!stu.Att}" var="key">
<td align="center" height="50px">
<apex:outputText value="{!if(stu.Att[key], 'P', 'A')}" rendered="{!NOT(edit_mode)}" style="width:40%"></apex:outputText>
<apex:inputCheckbox value="{!stu.Att[key]}" rendered="{!edit_mode}"/>
</td>
</apex:repeat>
<td width="80px" height="50px"><apex:outputtext value="{!stu.AttTotal}"></apex:outputtext></td>
</tr>
</apex:repeat>
</table>
</div>
</div>
</div>
</div>
Please giude me for fixing the width of <apex:repeat> Data .
In this output value :attendace value(P & A) exact comes but the problem comes in data header its comes only 1 month date ,
Please guide me .
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css"/>
<link rel="stylesheet" type="text/css" href="/css/result-light.css"/>
<style type='text/css'>
#container { margin: 10px; overflow: hidden; }
.relativeContainer { position: relative; width: auto; height: 400px; overflow: hidden; border: 1px solid green; }
td { background-color: white; padding: 2px; }
.fixedTB { position: absolute; left: 0px; top: 0px; z-index: 11; right:100px; }
.leftContainer { position: absolute; left: 0px; top: 52px; height: 350px; overflow: hidden; }
.rightContainer { position: absolute; left: 165px; top: 0px; width: auto; overflow: hidden; }
.leftSBWrapper { position: relative; left: 0px; top: 0px; z-index: 10; }
.topSBWrapper { position: relative; left: 0px; top: 0px; z-index: 10; }
.SBWrapper { width: 1100px; height: 250px; overflow: auto; }
</style>
<style>
#disp
{
font-family:garmond;
font-size:13px;
font-weight:bold
}
</style>
<script type="text/javascript">
function att(){
afatt();
}
</script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/excite-bike/jquery-ui.css"/>
<!-- Begin Default Content REMOVE THIS -->
<table border="0" width="100%">
<tr>
<td width="32%" align="left" style="padding-left:3px;"><apex:image url="{!$Resource.Pratham_logo}" height="58" width="350" /></td>
<td align="center"> <font size="5" face="calibri"><b><font face="candara" color="#019dd6">Pratham Institute - Student Attendance</font></b></font></td>
<td align="right" width="33%" style="padding-right:15px;"><apex:image url="{!$Resource.PACE_logo}" height="55" width="250" /></td>
</tr></table>
<apex:form id="frm">
<script type='text/javascript'>
$(window).load(function(){
$(function () {
$('.SBWrapper').scroll(function () {
var rc = $(this).closest('.relativeContainer');
var lfW = rc.find('.leftSBWrapper');
var tpW = rc.find('.topSBWrapper');
lfW.css('top', ($(this).scrollTop()*-1));
tpW.css('left', ($(this).scrollLeft()*-1));
});
});
});
</script>
<apex:actionFunction name="afsaveOnly" action="{!SaveOnly}" status="addRowStatus1" reRender="frm"/>
<apex:actionFunction name="afcancel" action="{!Cancel}" status="addRowStatus1" reRender="frm"/>
<apex:pageMessages />
<apex:pageBlock title="Students Attendance">
<apex:outputPanel >
<div id="container">
<div class="relativeContainer">
<!-- Fixed Column for both scroller -->
<div class="fixedTB">
<table border="1" width="164px" cellspacing="1" cellpadding="0" height="52px" >
<tr>
<td width="40px">Roll No.</td>
<td width="50px"> Student Name</td>
<td width="40px">Biometric Id</td>
</tr>
</table>
</div>
<div class="leftContainer">
<!-- Fixed Column for horz scroller -->
<div class="leftSBWrapper">
<table border="1" width="100px" cellspacing="1" cellpadding="0">
<apex:repeat value="{!oppTask}" var="stu">
<tr>
<td width="100px" height="50px"><apex:outputText value="{!stu.St.Student_Id__c}"/> </td>
<td width="80px" height="50px">
<apex:outputText value="{!stu.st.First_name__c} {!stu.st.Middle_name__c}
{!stu.st.Last_name__c}"/>
</td>
<td width="80px">
<apex:outputText value="{!stu.st.Biometric_Id__c}"/>
</td>
</tr></apex:repeat>
</table>
</div>
</div>
<div class="rightContainer">
<div class="topSBWrapper">
<table border="1" width="1400px" cellspacing="1" cellpadding="0" align="center">
<tr>
<apex:repeat value="{!attdates}" var="cur_date">
<td><apex:outputText value="{0,date,dd'/'MM}">
<apex:param value="{!cur_date}" />
</apex:outputText>
<!-- <apex:outputText value="{0, date, d MMM yyyy}"> <apex:param value="{!cur_date}" /> </apex:outputText>--> </td>
</apex:repeat>
<td><apex:outputText value="Total Attendance out of {!No_of_days}"/></td>
</tr>
</table>
</div>
<div class="SBWrapper">
<table border="1" width="1100px" cellspacing="1" cellpadding="0" align="center" >
<apex:repeat value="{!oppTask}" var="stu">
<tr>
<apex:repeat value="{!stu.Att}" var="key">
<td align="center" height="50px">
<apex:outputText value="{!if(stu.Att[key], 'P', 'A')}" rendered="{!NOT(edit_mode)}" style="width:40%"></apex:outputText>
<apex:inputCheckbox value="{!stu.Att[key]}" rendered="{!edit_mode}"/>
</td>
</apex:repeat>
<td width="80px" height="50px"><apex:outputtext value="{!stu.AttTotal}"></apex:outputtext></td>
</tr>
</apex:repeat>
</table>
</div>
</div>
</div>
</div>
-
- Radhika pawar 5
- December 19, 2014
- Like
- 0
- Continue reading or reply
apex:inputFile can't be used in conjunction with an action component when i'm trying to delete a row
I'm new to salesforce below i provided the issue and explanation.
Getting an issue "apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute"
When I'm trying to delete a row from PageBlockTable
In the visual source page, i first half of the screen i have component to upload the documents, below which i'm displaying the document. when i'm trying to delete the document in a particular row i'm getting the above issue.
Kindly help me how to resolve this issue.
Below I provided the code
Visualforce Page:
<apex:page controller="FileUploadController" sidebar="false" showHeader="false">
<apex:form enctype="multipart/form-data" id="docform">
<apex:pageBlock title="Document" id="docpb">
<table>
<tr>
<td> <apex:outputLabel value="Doc Code" for="docCode"/></td>
<td>
<apex:selectList value="{!docCode}" id="docCode" multiselect="false" size="1">
<apex:selectOptions value="{!docCodes}"/>
</apex:selectList>
</td>
</tr>
<tr>
<td>
<apex:outputLabel value="File" for="file"/>
</td>
<td>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
</td>
</tr>
<tr>
<td colspan='1'>
<apex:commandButton action="{!upload}" value="Save"/>
</td>
</tr>
</table>
</apex:pageBlock>
<apex:pageBlock title="Documents" id="dpb">
<apex:pageBlockTable value="{!documentList}" var="documentItem" id="documentTable">
<apex:column headerValue="Document Code">
<apex:outputField value="{!documentItem.Name}"/>
</apex:column>
<apex:column headerValue="Type">
<apex:outputField value="{!documentItem.Type}"/>
</apex:column>
<apex:column headerValue="Date">
<apex:outputField value="{!documentItem.LastReferencedDate}"/>
</apex:column>
<apex:column headerValue="User">
<apex:outputField value="{!documentItem.AuthorId}"/>
</apex:column>
<apex:column headerValue="Delete">
<apex:commandLink action="{!deleteDocument}" reRender="dpb"> <apex:image url="{!$Resource.DownLoad_Button}" />
<!-- <apex:image url="{!URLFOR($Resource.packaging, 'images/deleteicon.gif')}" /> -->
<apex:param value="{!documentItem.Name}" name="docCodeParam" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
<br/>
</apex:pageBlock>
</apex:form>
</apex:page>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My Controller :-
public class FileUploadController {
public PageReference deleteDocument() {
String docCodeParam = apexpages.currentpage().getparameters().get('docCodeParam');
System.debug('delete a document :: '+docCodeParam);
return null;
}
public String docCode {get; set;}
public List<Document> documentList {get; set;}
public List<Folder> folderList {get; set;}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}
public FileUploadController(){
folderList = [SELECT Id,Name FROM Folder WHERE Name = 'SMS Magic' ];
if(folderList!=null && !folderList.isEmpty()){
Folder folder = folderList.get(0);
documentList = [SELECT Name , Type , Url, AuthorId, Body ,
LastReferencedDate , LastViewedDate, FolderId FROM Document
document where FolderId IN:folderList ];
}
}
public PageReference upload() {
Boolean isSuccess = true;
if(folderList!=null && !folderList.isEmpty()){
Folder folder = folderList.get(0);
document.AuthorId = UserInfo.getUserId();
document.FolderId = folder.Id;// put it in running user's folder
document.name = docCode+'-'+document.name;
}
try {
insert document;
} catch (DMLException e) {
isSuccess = false;
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
} finally {
document.body = null; // clears the viewstate
document = new Document();
}
if(isSuccess){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
}
return null;
}
public List<SelectOption> getDocCodes(){
List<SelectOption> docCodeList = new List<SelectOption>();
docCodeList.add(new SelectOption('',''));
docCodeList.add(new SelectOption('PHOTO',' PHOTO'));
docCodeList.add(new SelectOption('DOC','DOC'));
return docCodeList;
}
}
Thanks advance your answers
Getting an issue "apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute"
When I'm trying to delete a row from PageBlockTable
In the visual source page, i first half of the screen i have component to upload the documents, below which i'm displaying the document. when i'm trying to delete the document in a particular row i'm getting the above issue.
Kindly help me how to resolve this issue.
Below I provided the code
Visualforce Page:
<apex:page controller="FileUploadController" sidebar="false" showHeader="false">
<apex:form enctype="multipart/form-data" id="docform">
<apex:pageBlock title="Document" id="docpb">
<table>
<tr>
<td> <apex:outputLabel value="Doc Code" for="docCode"/></td>
<td>
<apex:selectList value="{!docCode}" id="docCode" multiselect="false" size="1">
<apex:selectOptions value="{!docCodes}"/>
</apex:selectList>
</td>
</tr>
<tr>
<td>
<apex:outputLabel value="File" for="file"/>
</td>
<td>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
</td>
</tr>
<tr>
<td colspan='1'>
<apex:commandButton action="{!upload}" value="Save"/>
</td>
</tr>
</table>
</apex:pageBlock>
<apex:pageBlock title="Documents" id="dpb">
<apex:pageBlockTable value="{!documentList}" var="documentItem" id="documentTable">
<apex:column headerValue="Document Code">
<apex:outputField value="{!documentItem.Name}"/>
</apex:column>
<apex:column headerValue="Type">
<apex:outputField value="{!documentItem.Type}"/>
</apex:column>
<apex:column headerValue="Date">
<apex:outputField value="{!documentItem.LastReferencedDate}"/>
</apex:column>
<apex:column headerValue="User">
<apex:outputField value="{!documentItem.AuthorId}"/>
</apex:column>
<apex:column headerValue="Delete">
<apex:commandLink action="{!deleteDocument}" reRender="dpb"> <apex:image url="{!$Resource.DownLoad_Button}" />
<!-- <apex:image url="{!URLFOR($Resource.packaging, 'images/deleteicon.gif')}" /> -->
<apex:param value="{!documentItem.Name}" name="docCodeParam" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
<br/>
</apex:pageBlock>
</apex:form>
</apex:page>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My Controller :-
public class FileUploadController {
public PageReference deleteDocument() {
String docCodeParam = apexpages.currentpage().getparameters().get('docCodeParam');
System.debug('delete a document :: '+docCodeParam);
return null;
}
public String docCode {get; set;}
public List<Document> documentList {get; set;}
public List<Folder> folderList {get; set;}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}
public FileUploadController(){
folderList = [SELECT Id,Name FROM Folder WHERE Name = 'SMS Magic' ];
if(folderList!=null && !folderList.isEmpty()){
Folder folder = folderList.get(0);
documentList = [SELECT Name , Type , Url, AuthorId, Body ,
LastReferencedDate , LastViewedDate, FolderId FROM Document
document where FolderId IN:folderList ];
}
}
public PageReference upload() {
Boolean isSuccess = true;
if(folderList!=null && !folderList.isEmpty()){
Folder folder = folderList.get(0);
document.AuthorId = UserInfo.getUserId();
document.FolderId = folder.Id;// put it in running user's folder
document.name = docCode+'-'+document.name;
}
try {
insert document;
} catch (DMLException e) {
isSuccess = false;
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
} finally {
document.body = null; // clears the viewstate
document = new Document();
}
if(isSuccess){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
}
return null;
}
public List<SelectOption> getDocCodes(){
List<SelectOption> docCodeList = new List<SelectOption>();
docCodeList.add(new SelectOption('',''));
docCodeList.add(new SelectOption('PHOTO',' PHOTO'));
docCodeList.add(new SelectOption('DOC','DOC'));
return docCodeList;
}
}
Thanks advance your answers
-
- Radhika pawar 5
- December 05, 2014
- Like
- 0
- Continue reading or reply
Upload the file Document in separate Folder
Senario: when i upload the file ,its saves in my personal Document
But my Requirement is it should be saved in Different folders name/separate Name
eg:SMS Imgica,Read in india etc.
Hey guys please give me solution for below code:
public with sharing class ctrlDocumentInfo
{
public String FolderName {get;set;}
public String folder { get; set; }
public ctrlDocumentInfo()
{FolderName = '';
}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}
public List<SelectOption> getAttFold()
{
List<SelectOption>lstfold = new List<SelectOption>();
for(folder objFolder:[select id,name from folder where type='document' ]){
lstfold.add(new SelectOption(objFolder.id, objFolder.Name));
}
return lstfold;
}
public PageReference upload()
{
document.AuthorId = UserInfo.getUserId();
//Folder f=[SELECT Id,Name FROM Folder WHERE Folder.Name = 'SMS Magic' ];
document.FolderId = UserInfo.getUserId(); // put it in running user's folder
// document.folderId = f;
try {
insert document;
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
return null;
} finally {
document.body = null; // clears the viewstate
document = new Document();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
return null;
}
}
But my Requirement is it should be saved in Different folders name/separate Name
eg:SMS Imgica,Read in india etc.
Hey guys please give me solution for below code:
public with sharing class ctrlDocumentInfo
{
public String FolderName {get;set;}
public String folder { get; set; }
public ctrlDocumentInfo()
{FolderName = '';
}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}
public List<SelectOption> getAttFold()
{
List<SelectOption>lstfold = new List<SelectOption>();
for(folder objFolder:[select id,name from folder where type='document' ]){
lstfold.add(new SelectOption(objFolder.id, objFolder.Name));
}
return lstfold;
}
public PageReference upload()
{
document.AuthorId = UserInfo.getUserId();
//Folder f=[SELECT Id,Name FROM Folder WHERE Folder.Name = 'SMS Magic' ];
document.FolderId = UserInfo.getUserId(); // put it in running user's folder
// document.folderId = f;
try {
insert document;
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
return null;
} finally {
document.body = null; // clears the viewstate
document = new Document();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
return null;
}
}
-
- Radhika pawar 5
- December 03, 2014
- Like
- 0
- Continue reading or reply
Error: System.NullPointerException: Argument 1 cannot be null .for soql Query
Below is my scenario:
There are 3 pick lists comming from parent object(School_List) in Child object(RI_Follow_Up_School_Report_Card).
When i will select value from first picklist (National) :Example (India) then 2nd picklist (State) should get refresh and show all states.
And simmilarly when i will Select State Name from 2nd picklist (Example -Maharashtra) then 3rd picklist (BRG Name) should get refresh and show all BRG Names
from that particular state. Here I am getting NullPointerException error for below query. And I am getting this error only when I am running this in production, however it is running succefully on Sandbox.
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_Follow_Up_School_Report_Card__c where FW_Submission_No__c != null AND FW_Submission_No__c != 0 AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBRG() {
List<SelectOption> lstBRG = new List<SelectOption>();
String query = 'Select BRG_Camp_1__r.Name brg, BRG_Camp_1__c id from RI_Follow_Up_School_Report_Card__c where School_List__r.state__c =: strState AND School_List__r.National__c =: strNational';
query += ' GROUP BY BRG_Camp_1__c, BRG_Camp_1__r.Name';
AggregateResult []ar = Database.query(query);
lstBRG .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstBRG.add(new SelectOption(String.valueOf(temp.get('id')),String.valueOf(temp.get('brg'))));
}
Below is the complete code. Please help
Apex Class:
public with sharing class ctrltestfwrd
{
public List<SelectOption> lstNational {get;set;}
public List<List<String>> lstReport {get;set;}
public List<List<String>> lstReport1 {get;set;}
public List<List<String>> lstReport2 {get;set;}
public List<RI_Follow_Up_School_Report_Card__c> lstSchool = new List<RI_Follow_Up_School_Report_Card__c>();
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strBRG {get;set;}
public ctrltestfwrd () {
strState = '';
strBlocks = '';
strNational = '';
strBRG = '';
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues()) {
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstReport = new List<List<String>> ();
lstReport1 = new List<List<String>> ();
lstReport2 = new List<List<String>> ();
if (strNational != '' && strNational != null) {}
else{loadReport();}
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_Follow_Up_School_Report_Card__c where FW_Submission_No__c != null AND FW_Submission_No__c != 0 AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBRG() {
List<SelectOption> lstBRG = new List<SelectOption>();
String query = 'Select BRG_Camp_1__r.Name brg, BRG_Camp_1__c id from RI_Follow_Up_School_Report_Card__c where School_List__r.state__c =: strState AND School_List__r.National__c =: strNational';
query += ' GROUP BY BRG_Camp_1__c, BRG_Camp_1__r.Name';
AggregateResult []ar = Database.query(query);
lstBRG .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstBRG.add(new SelectOption(String.valueOf(temp.get('id')),String.valueOf(temp.get('brg'))));
}
return lstBRG ;
}
public pagereference loadReport()
{return null;
}}
VF page Code:
<apex:page controller="ctrltestfwrd" showHeader="false" sidebar="false">
<table border="0" cellspacing="2" cellpadding="" align="left" width="100%">
<tr>
<td width="17%"><apex:image url="{!$Resource.Pratham_Logo_png}" height="60" width="220" /></td>
<td><center><font face="Calibri" size="6" color="black"><b>Read India Reports - 2014</b></font></center>
</td>
<td align="right" width="17%"><a href="http://pratham.force.com/RIReports2014"><apex:image url="{!$Resource.Home}" height="50" width="50"/></a> </td>
</tr>
</table>
<hr color="gold" size="4"/>
<!-- Begin Default Content REMOVE THIS -->
<center><font face="calibri" size="5" color="#FF6633"><b>Language: Reading Analysis</b></font><br/>
<font face="calibri" size="3.5" color="Blue"> <b> Reading Learning Level Analysis across Camps</b><br/><br/></font>
</center>
<apex:form id="frm">
<apex:pageBlock >
<center>
<apex:SelectList value="{!strNational}" size="1" multiselect="false" style="width:150px;">
<font face="calibri" size="3"><b>National :</b> </font><apex:SelectOptions value="{!lstNational}"/>
<apex:actionsupport event="onchange" rerender="child_states"/>
</apex:SelectList>
<apex:SelectList value="{!strState}" size="1" multiselect="false" style="width:150px;" id="child_states">
<font face="calibri" size="3"><b>Select State :</b> </font><apex:SelectOptions value="{!AttStates}"/>
<apex:actionsupport event="onchange" rerender="child_brg,child_blocks"/>
</apex:SelectList>
<!--<apex:SelectList value="{!strBlocks}" size="1" multiselect="false" style="width:150px;" id="child_blocks">
<font face="calibri" size="3"><b>Select Block :</b> </font><apex:SelectOptions value="{!AttBlocks}"/>
</apex:SelectList>--><br/>
<hr color="#000" align="center" width="60%"/>
<apex:SelectList value="{!strBRG}" size="1" multiselect="false" style="width:150px;" id="child_brg">
<font face="calibri" size="3"><b>Select BRG :</b> </font><apex:SelectOptions value="{!AttBrg}"/>
</apex:SelectList>
<br/><br/>
<apex:commandButton value="Go" action="{!loadReport}" status="Status" reRender="frm, panel2, campmodel" style="width:70px; font-family: 'candara'; font-size: 12pt; color: #0000ff; background-color: #FFFFC0; border: 2pt ridge gold" oncomplete="drawChart();" />
<apex:actionStatus id="Status">
<apex:facet name="start">
<img style="padding-left:10px;" src="/img/loading.gif" />
</apex:facet>
</apex:actionStatus>
</center><br/>
<center><b><i><apex:outputText value="[ Note: This report is updated up to {!today()} ]" style="font-family:calibri;font-size:14px;color:black;font-weight:bold;"/></i></b></center>
</apex:pageblock>
</apex:form>
</apex:page>
There are 3 pick lists comming from parent object(School_List) in Child object(RI_Follow_Up_School_Report_Card).
When i will select value from first picklist (National) :Example (India) then 2nd picklist (State) should get refresh and show all states.
And simmilarly when i will Select State Name from 2nd picklist (Example -Maharashtra) then 3rd picklist (BRG Name) should get refresh and show all BRG Names
from that particular state. Here I am getting NullPointerException error for below query. And I am getting this error only when I am running this in production, however it is running succefully on Sandbox.
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_Follow_Up_School_Report_Card__c where FW_Submission_No__c != null AND FW_Submission_No__c != 0 AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBRG() {
List<SelectOption> lstBRG = new List<SelectOption>();
String query = 'Select BRG_Camp_1__r.Name brg, BRG_Camp_1__c id from RI_Follow_Up_School_Report_Card__c where School_List__r.state__c =: strState AND School_List__r.National__c =: strNational';
query += ' GROUP BY BRG_Camp_1__c, BRG_Camp_1__r.Name';
AggregateResult []ar = Database.query(query);
lstBRG .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstBRG.add(new SelectOption(String.valueOf(temp.get('id')),String.valueOf(temp.get('brg'))));
}
Below is the complete code. Please help
Apex Class:
public with sharing class ctrltestfwrd
{
public List<SelectOption> lstNational {get;set;}
public List<List<String>> lstReport {get;set;}
public List<List<String>> lstReport1 {get;set;}
public List<List<String>> lstReport2 {get;set;}
public List<RI_Follow_Up_School_Report_Card__c> lstSchool = new List<RI_Follow_Up_School_Report_Card__c>();
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strBRG {get;set;}
public ctrltestfwrd () {
strState = '';
strBlocks = '';
strNational = '';
strBRG = '';
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues()) {
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstReport = new List<List<String>> ();
lstReport1 = new List<List<String>> ();
lstReport2 = new List<List<String>> ();
if (strNational != '' && strNational != null) {}
else{loadReport();}
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_Follow_Up_School_Report_Card__c where FW_Submission_No__c != null AND FW_Submission_No__c != 0 AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBRG() {
List<SelectOption> lstBRG = new List<SelectOption>();
String query = 'Select BRG_Camp_1__r.Name brg, BRG_Camp_1__c id from RI_Follow_Up_School_Report_Card__c where School_List__r.state__c =: strState AND School_List__r.National__c =: strNational';
query += ' GROUP BY BRG_Camp_1__c, BRG_Camp_1__r.Name';
AggregateResult []ar = Database.query(query);
lstBRG .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstBRG.add(new SelectOption(String.valueOf(temp.get('id')),String.valueOf(temp.get('brg'))));
}
return lstBRG ;
}
public pagereference loadReport()
{return null;
}}
VF page Code:
<apex:page controller="ctrltestfwrd" showHeader="false" sidebar="false">
<table border="0" cellspacing="2" cellpadding="" align="left" width="100%">
<tr>
<td width="17%"><apex:image url="{!$Resource.Pratham_Logo_png}" height="60" width="220" /></td>
<td><center><font face="Calibri" size="6" color="black"><b>Read India Reports - 2014</b></font></center>
</td>
<td align="right" width="17%"><a href="http://pratham.force.com/RIReports2014"><apex:image url="{!$Resource.Home}" height="50" width="50"/></a> </td>
</tr>
</table>
<hr color="gold" size="4"/>
<!-- Begin Default Content REMOVE THIS -->
<center><font face="calibri" size="5" color="#FF6633"><b>Language: Reading Analysis</b></font><br/>
<font face="calibri" size="3.5" color="Blue"> <b> Reading Learning Level Analysis across Camps</b><br/><br/></font>
</center>
<apex:form id="frm">
<apex:pageBlock >
<center>
<apex:SelectList value="{!strNational}" size="1" multiselect="false" style="width:150px;">
<font face="calibri" size="3"><b>National :</b> </font><apex:SelectOptions value="{!lstNational}"/>
<apex:actionsupport event="onchange" rerender="child_states"/>
</apex:SelectList>
<apex:SelectList value="{!strState}" size="1" multiselect="false" style="width:150px;" id="child_states">
<font face="calibri" size="3"><b>Select State :</b> </font><apex:SelectOptions value="{!AttStates}"/>
<apex:actionsupport event="onchange" rerender="child_brg,child_blocks"/>
</apex:SelectList>
<!--<apex:SelectList value="{!strBlocks}" size="1" multiselect="false" style="width:150px;" id="child_blocks">
<font face="calibri" size="3"><b>Select Block :</b> </font><apex:SelectOptions value="{!AttBlocks}"/>
</apex:SelectList>--><br/>
<hr color="#000" align="center" width="60%"/>
<apex:SelectList value="{!strBRG}" size="1" multiselect="false" style="width:150px;" id="child_brg">
<font face="calibri" size="3"><b>Select BRG :</b> </font><apex:SelectOptions value="{!AttBrg}"/>
</apex:SelectList>
<br/><br/>
<apex:commandButton value="Go" action="{!loadReport}" status="Status" reRender="frm, panel2, campmodel" style="width:70px; font-family: 'candara'; font-size: 12pt; color: #0000ff; background-color: #FFFFC0; border: 2pt ridge gold" oncomplete="drawChart();" />
<apex:actionStatus id="Status">
<apex:facet name="start">
<img style="padding-left:10px;" src="/img/loading.gif" />
</apex:facet>
</apex:actionStatus>
</center><br/>
<center><b><i><apex:outputText value="[ Note: This report is updated up to {!today()} ]" style="font-family:calibri;font-size:14px;color:black;font-weight:bold;"/></i></b></center>
</apex:pageblock>
</apex:form>
</apex:page>
-
- Radhika pawar 5
- November 23, 2014
- Like
- 0
- Continue reading or reply
How to export google chart to excel from VF Page
Hi Frnds Plz Guide me for Exporting Google Chart to excel From Vf Page .
<script type="text/javascript"> // google.load("visualization", "1", {packages:["corechart"]}); // google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['X', '{!lstwrap1Sub[lstwrap1Sub.size-1].grouper}'], ['Govt Official', {!lstwrap1Sub[lstwrap1Sub.size-1].Govt_Official}], ['state_head', {!lstwrap1Sub[lstwrap1Sub.size-1].state_head}], ['SRG', {!lstwrap1Sub[lstwrap1Sub.size-1].SRG}], ['BC_DRL', {!lstwrap1Sub[lstwrap1Sub.size-1].BC_DRL}], ['MME_TEAM', {!lstwrap1Sub[lstwrap1Sub.size-1].MME_Team}], ['Other_Visits', {!lstwrap1Sub[lstwrap1Sub.size-1].other_visit}] ]); var options = { title: 'Monitoring Visits' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script>
<script type="text/javascript"> // google.load("visualization", "1", {packages:["corechart"]}); // google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['X', '{!lstwrap1Sub[lstwrap1Sub.size-1].grouper}'], ['Govt Official', {!lstwrap1Sub[lstwrap1Sub.size-1].Govt_Official}], ['state_head', {!lstwrap1Sub[lstwrap1Sub.size-1].state_head}], ['SRG', {!lstwrap1Sub[lstwrap1Sub.size-1].SRG}], ['BC_DRL', {!lstwrap1Sub[lstwrap1Sub.size-1].BC_DRL}], ['MME_TEAM', {!lstwrap1Sub[lstwrap1Sub.size-1].MME_Team}], ['Other_Visits', {!lstwrap1Sub[lstwrap1Sub.size-1].other_visit}] ]); var options = { title: 'Monitoring Visits' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script>
-
- Radhika pawar 5
- October 30, 2014
- Like
- 0
- Continue reading or reply
convert google chart to image in VF page
I have one Requirement to convert google chart(graph) to image.i m using in VF Page
<!--- Bar Char Code -->
<center>
<script type="text/javascript">
//google.setOnLoadCallback(drawChart);
var functionname ="reading_report";
functionname = functionname.replace(/[^A-Z0-9]+/ig, "_");
//functionname = functionname.replace(/./g, '_');
window[functionname] = function() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Metrics', 'Beginner', 'Letter', 'Word', 'Para', 'Story'],
<apex:repeat value="{!lstReport}" var="report">
["{!report[0]}", {!report[1]}, {!report[2]}, {!report[3]}, {!report[4]}, {!report[5]}],
</apex:repeat>
]);
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById("reading_report")).
draw(data,
{title:"Reading Baseline Trends - National",
width:600, height:400,isStacked:true,
hAxis: {title: ""},
vAxis: {minValue: 0},
vAxis: {maxValue: 100}}
);
}
</script>
<div id="reading_report" class="googlechart"></div> </center>
<!-- End of Bar Chart -->
<!--- Bar Char Code -->
<center>
<script type="text/javascript">
//google.setOnLoadCallback(drawChart);
var functionname ="reading_report";
functionname = functionname.replace(/[^A-Z0-9]+/ig, "_");
//functionname = functionname.replace(/./g, '_');
window[functionname] = function() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Metrics', 'Beginner', 'Letter', 'Word', 'Para', 'Story'],
<apex:repeat value="{!lstReport}" var="report">
["{!report[0]}", {!report[1]}, {!report[2]}, {!report[3]}, {!report[4]}, {!report[5]}],
</apex:repeat>
]);
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById("reading_report")).
draw(data,
{title:"Reading Baseline Trends - National",
width:600, height:400,isStacked:true,
hAxis: {title: ""},
vAxis: {minValue: 0},
vAxis: {maxValue: 100}}
);
}
</script>
<div id="reading_report" class="googlechart"></div> </center>
<!-- End of Bar Chart -->
-
- Radhika pawar 5
- October 29, 2014
- Like
- 0
- Continue reading or reply
How to download records related to google map of pie chart and save in Excel Format through Visualforce page
How to download Pie chart records and save in Excel Format through Visualforce page
-
- Radhika pawar 5
- October 27, 2014
- Like
- 0
- Continue reading or reply
addition of two integer value divide by another integer value outputcomes in decimal for Controller
Please Guide me Only use controller as soon as possible.
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
-
- Radhika pawar 5
- October 18, 2014
- Like
- 0
- Continue reading or reply
addition of two integer value divide by another integer value outputcomes in decimal for Controller
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
-
- Radhika pawar 5
- October 17, 2014
- Like
- 0
- Continue reading or reply
How to Pass value on check box changed into Contoller
plz send me the code example .........
-
- Radhika pawar 5
- September 29, 2014
- Like
- 0
- Continue reading or reply
using jquery: page is reloaded when checkbox is selected.
Hi friend,
I m using jquery for auomatically set check box is true .
In that i want page reloaded for saved in database so
plz reply me as soon as possible.
Thank you .
I m using jquery for auomatically set check box is true .
In that i want page reloaded for saved in database so
plz reply me as soon as possible.
Thank you .
-
- Radhika pawar 5
- September 23, 2014
- Like
- 0
- Continue reading or reply
once checkbox is checked? how to refresh the page or how to call page load
Hi Group,
I have one requirement once i m clicking on checkbox then same Page automatically refreshed the Page or reload the Page or it will automatically saved on backend .
using jquey.
My Code Is :-
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
var p= $("[id$=submit2yes]").attr("checked", true);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
$("[id$=submit3]").attr("checked", true);
}
Thanks you,
Rad.
I have one requirement once i m clicking on checkbox then same Page automatically refreshed the Page or reload the Page or it will automatically saved on backend .
using jquey.
My Code Is :-
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
var p= $("[id$=submit2yes]").attr("checked", true);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
$("[id$=submit3]").attr("checked", true);
}
Thanks you,
Rad.
-
- Radhika pawar 5
- September 23, 2014
- Like
- 0
- Continue reading or reply
using rendered ,I want to hide text fields once checkbox is checked
Hi Group,
I have one requirement in VF page, I want to hide input fields (TextFields) once i m clicked on checkbox.
Example:-there is camp1 date and 1 checkbox.
once i m selecting checkbox then my camp1 date input fields will be hidden.
I know this is possible using javasript but i want to use rendered .
so please guide me .
I have one requirement in VF page, I want to hide input fields (TextFields) once i m clicked on checkbox.
Example:-there is camp1 date and 1 checkbox.
once i m selecting checkbox then my camp1 date input fields will be hidden.
I know this is possible using javasript but i want to use rendered .
so please guide me .
-
- Radhika pawar 5
- September 23, 2014
- Like
- 0
- Continue reading or reply
Check Bellow code ,In that i want to Yes No button ,this are rename to No and cancel Button
<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>
Outputbox:OK and cancel button but i want yes ,no Button label
Plz guide me
'I m new in jquery...........................
Thank you
Radhika pawar
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>
Outputbox:OK and cancel button but i want yes ,no Button label
Plz guide me
'I m new in jquery...........................
Thank you
Radhika pawar
-
- Radhika pawar 5
- September 18, 2014
- Like
- 0
- Continue reading or reply
I want yes/No alerts using jQuery, instead of ok/Cancel button
I want to change button name which is presented in popupbox.
If ok and cancel button presented in popupbox then i wan to rename yes and no using jquery.
please guid me
If ok and cancel button presented in popupbox then i wan to rename yes and no using jquery.
please guid me
-
- Radhika pawar 5
- September 18, 2014
- Like
- 0
- Continue reading or reply
Jquery
Hi friends,
I m doing Pupup box messages with the of jquery:
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
}
Every time It will show the message ater i click on save bUTTON.
In that I want:
Once i m selecting ok button on popup box then dont show repedatly pupup messages after click on save button.
I m doing Pupup box messages with the of jquery:
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
}
Every time It will show the message ater i click on save bUTTON.
In that I want:
Once i m selecting ok button on popup box then dont show repedatly pupup messages after click on save button.
-
- Radhika pawar 5
- September 18, 2014
- Like
- 0
- Continue reading or reply
How to export google chart to excel from VF Page
Hi Frnds Plz Guide me for Exporting Google Chart to excel From Vf Page .
<script type="text/javascript"> // google.load("visualization", "1", {packages:["corechart"]}); // google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['X', '{!lstwrap1Sub[lstwrap1Sub.size-1].grouper}'], ['Govt Official', {!lstwrap1Sub[lstwrap1Sub.size-1].Govt_Official}], ['state_head', {!lstwrap1Sub[lstwrap1Sub.size-1].state_head}], ['SRG', {!lstwrap1Sub[lstwrap1Sub.size-1].SRG}], ['BC_DRL', {!lstwrap1Sub[lstwrap1Sub.size-1].BC_DRL}], ['MME_TEAM', {!lstwrap1Sub[lstwrap1Sub.size-1].MME_Team}], ['Other_Visits', {!lstwrap1Sub[lstwrap1Sub.size-1].other_visit}] ]); var options = { title: 'Monitoring Visits' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script>
<script type="text/javascript"> // google.load("visualization", "1", {packages:["corechart"]}); // google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['X', '{!lstwrap1Sub[lstwrap1Sub.size-1].grouper}'], ['Govt Official', {!lstwrap1Sub[lstwrap1Sub.size-1].Govt_Official}], ['state_head', {!lstwrap1Sub[lstwrap1Sub.size-1].state_head}], ['SRG', {!lstwrap1Sub[lstwrap1Sub.size-1].SRG}], ['BC_DRL', {!lstwrap1Sub[lstwrap1Sub.size-1].BC_DRL}], ['MME_TEAM', {!lstwrap1Sub[lstwrap1Sub.size-1].MME_Team}], ['Other_Visits', {!lstwrap1Sub[lstwrap1Sub.size-1].other_visit}] ]); var options = { title: 'Monitoring Visits' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script>
- Radhika pawar 5
- October 30, 2014
- Like
- 0
- Continue reading or reply
addition of two integer value divide by another integer value outputcomes in decimal for Controller
Please Guide me Only use controller as soon as possible.
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
- Radhika pawar 5
- October 18, 2014
- Like
- 0
- Continue reading or reply
addition of two integer value divide by another integer value outputcomes in decimal for Controller
I have one Error for Illegal assignment from Decimal to Integer at line 178 column 13
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
List<Integer> total = new List<Integer>();
table in that SR.No(Serial No) ,Number of villages reached,Govt Schools,Pvt Schools,Other Schools,Avg other schools in the Pratham intervention areas columns.
Example: this are Column
SRNO. (Number of villages reached) (Govt Schools ) (Pvt Schools) (Other Schools) (Avg other schools in the Pratham intervention areas)
1 4 1 2 3 3+2+1/4=1.5
I want 1.5 values in last column name is Other Schools Avg other schools in the Pratham intervention areas.
but my out put comes 1 in integer .
please guide me.
My code is this:
public with sharing class ctrl_RI14_other_school_trends {
public List<SelectOption> lstNational {get;set;}
public List<SelectOption> lstPhase {get;set;}
//public List<SelectOption> lstDonor = new List<SelectOption>();
public List<RI_School_Report_Cards__c> lstSchool = new List<RI_School_Report_Cards__c>();
public List<Report> lstwrap1Sub {get;set;}
public String strState {get;set;}
public String strBlocks {get;set;}
public String strNational {get;set;}
public String strSchool {get;set;}
public String strPhase {get;set;}
// public String strDonor {get;set;}
public ctrl_RI14_other_school_trends()
{
strState = '';
strBlocks = '';
strNational = '' ;
strSchool = '';
strPhase = '';
// strDonor = '';
lstPhase = new List<SelectOption>();
lstPhase.add(new SelectOption('', '- - None - -'));
Schema.DescribeFieldResult F = RI_School_Report_Cards__c.BCI_CP_P_NO__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstPhase.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstNational = new List<SelectOption>();
lstNational.add(new SelectOption('', '- - None - -'));
F = RI_School_List__c.National__c.getDescribe();
for (Schema.PicklistEntry temp : F.getPicklistValues())
{
lstNational.add(new SelectOption(temp.getValue(), temp.getLabel()));
}
lstwrap1Sub = new List<Report>();
}
public List<SelectOption> getAttStates() {
List<SelectOption>lstSchoolStates = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.State__c State from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.National__c =: strNational GROUP BY School_List__r.State__c];
lstSchoolStates .add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolStates.add(new SelectOption(String.valueOf(temp.get('State')),String.valueOf(temp.get('State'))));
}
return lstSchoolStates ;
}
public List<SelectOption> getAttBlocks() {
List<SelectOption> lstSchoolBlocks = new List<SelectOption>();
AggregateResult []ar = [Select School_List__r.block__c block from RI_School_Report_Cards__c where Submission_No__c != null AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational GROUP BY School_List__r.block__c ];
lstSchoolBlocks.add(new SelectOption('','-None-'));
for(AggregateResult temp: ar) {
lstSchoolBlocks.add(new SelectOption(String.valueOf(temp.get('block')),String.valueOf(temp.get('block'))));
}
return lstSchoolBlocks;
}
public List<SelectOption> getAttSchool() {
List<SelectOption> lstSchools = new List<SelectOption>();
List<RI_School_Report_Cards__c> lst = [Select School_List__r.Name, school_list__c, school_list__r.School__c from RI_School_Report_Cards__c where Submission_No__c != null AND Submit_Camp_4__c = true AND School_List__r.state__c =: strState AND School_List__r.National__c =: strNational AND school_list__r.block__c =: strBlocks];
lstSchools.add(new SelectOption('','-None-'));
for(RI_School_Report_Cards__c temp: lst) {
lstSchools.add(new SelectOption(temp.school_list__c, temp.school_list__r.school__c + ' : ' + temp.school_list__r.Name));
}
return lstSchools;
}
public pagereference loadReport()
{
lstwrap1Sub.clear();
String query = 'SELECT COUNT(School_List__r.Village__c) reached,SUM(MI_TL_Gov_SL__c) GOV_SL, SUM(MI_TL_Pvt_SL__c) PVT_SL, SUM(MI_TL_Other_SL__c) Other_SL';
if (strState == '' || strState == null)
{
query += ', School_List__r.State__c grouper';
}
else if(strBlocks == '' || strBlocks == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
if(strSchool == '' || strSchool == null)
{
query += ', School_List__r.block__c grouper';
}
else
{
query += ', School_List__r.Name grouper';
}
}
query += ' FROM RI_School_Report_Cards__c WHERE School_List__r.National__c =: strNational AND Submission_No__c != null ';
if (strState != '' && strState != null) {
query += ' AND school_list__r.state__c =: strState';
}
if(strBlocks != '' && strBlocks != null) {
query += ' AND school_list__r.block__c =: strBlocks';
}
if(strSchool != '' && strSchool != null) {
query += ' AND school_list__c =: strSchool';
}
if(strPhase != '' && strPhase != null) {
query += ' AND BCI_CP_P_NO__c =: strPhase';
}
if (strState == '' || strState == null) {
query += ' GROUP BY School_List__r.State__c';
}
else if (strBlocks == '' || strBlocks == null)
{
query += ' GROUP BY School_List__r.block__c';
}
else
{
if(strSchool == '' || strSchool == null)
{query += ' GROUP BY School_List__r.block__c';}
else
{query += ' GROUP BY School_List__r.Name ';}
}
AggregateResult []ar = Database.query(query);
Map <String, Integer> reach = new Map<String, Integer>();
Map <String, Integer> GOV = new Map<String, Integer>();
Map <String, Integer> PVT = new Map<String, Integer>();
Map <String, Integer> Other = new Map<String, Integer>();
for (AggregateResult temp : ar)
{
if(Integer.valueOf(temp.get('reached')) !=0)
{
reach.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('reached')));
}
GOV.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('GOV_SL')));
PVT.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('PVT_SL')));
Other.put(String.valueOf(temp.get('grouper')), Integer.valueOf(temp.get('Other_SL')));
}
Integer i = 1;
for(AggregateResult temp : ar)
{
lstwrap1Sub.add(new Report(i, String.valueOf(temp.get('grouper')), reach.get(String.valueOf(temp.get('grouper'))), GOV.get(String.valueOf(temp.get('grouper'))), PVT.get(String.valueOf(temp.get('grouper'))),Other.get(String.valueOf(temp.get('grouper'))),
((GOV.get(String.valueOf(temp.get('grouper')))+ PVT.get(String.valueOf(temp.get('grouper')))+ Other.get(String.valueOf(temp.get('grouper'))) )/reach.get(String.valueOf(temp.get('grouper')))) ));
i++;
}
List<Integer> total = new List<Integer>();
total.add(0);
total.add(0);
total.add(0);
total.add(0);
total.add(0);
if (strBlocks == '' || strBlocks == null) {
for(Report temp : lstwrap1Sub)
{
total[0] += temp.reached;
total[1] += temp.GOV_SL;
total[2] += temp.PVT_SL;
total[3] += temp.Other_SL;
total[4] += temp.avg;
}
lstwrap1Sub.add(new Report(null, 'Total', total[0], total[1], total[2], total[3], total[4]));
}
return null;
}
class Report
{
public Integer reached {get;set;}
public String grouper {get;set;}
public Integer sr_no {get;set;}
public Integer GOV_SL{get;set;}
public Integer PVT_SL{get;set;}
public Integer Other_SL{get;set;}
public Integer avg {get;set;}
public Report(Integer sr_no,String grouper,Integer reached,Integer GOVSL,Integer PVTSL,Integer other,Integer avg_gpo )
{
this.grouper = grouper;
this.sr_no = sr_no;
this.reached = reached == null ? 0 : reached;
this.GOV_SL = GOVSL == null ? 0 : GOVSL;
this.PVT_SL = PVTSL== null ? 0 : PVTSL;
this.Other_SL = other== null ? 0 : other;
this.avg = avg_gpo == null ? 0 :avg_gpo;
}
}
}
- Radhika pawar 5
- October 17, 2014
- Like
- 0
- Continue reading or reply
using jquery: page is reloaded when checkbox is selected.
Hi friend,
I m using jquery for auomatically set check box is true .
In that i want page reloaded for saved in database so
plz reply me as soon as possible.
Thank you .
I m using jquery for auomatically set check box is true .
In that i want page reloaded for saved in database so
plz reply me as soon as possible.
Thank you .
- Radhika pawar 5
- September 23, 2014
- Like
- 0
- Continue reading or reply
once checkbox is checked? how to refresh the page or how to call page load
Hi Group,
I have one requirement once i m clicking on checkbox then same Page automatically refreshed the Page or reload the Page or it will automatically saved on backend .
using jquey.
My Code Is :-
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
var p= $("[id$=submit2yes]").attr("checked", true);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
$("[id$=submit3]").attr("checked", true);
}
Thanks you,
Rad.
I have one requirement once i m clicking on checkbox then same Page automatically refreshed the Page or reload the Page or it will automatically saved on backend .
using jquey.
My Code Is :-
if (confirm("Does the School Have 1 Camp OR 2 Camps !") == true)
{
x = "Camp 2!";
alert("This School has 2 follow Up Camps :"+x);
$("[id$=submit3]").attr("checked", false);
var p= $("[id$=submit2yes]").attr("checked", true);
}
else
{
x ="Camp 1!";
alert("This School has 1 Follow Up Camp :"+x);
$("[id$=submit3]").attr("checked", true);
}
Thanks you,
Rad.
- Radhika pawar 5
- September 23, 2014
- Like
- 0
- Continue reading or reply
I want yes/No alerts using jQuery, instead of ok/Cancel button
I want to change button name which is presented in popupbox.
If ok and cancel button presented in popupbox then i wan to rename yes and no using jquery.
please guid me
If ok and cancel button presented in popupbox then i wan to rename yes and no using jquery.
please guid me
- Radhika pawar 5
- September 18, 2014
- Like
- 0
- Continue reading or reply
I want checkbox1 is checked after save buttton message using jquery or javasript......
Hi Friends...
I have 3 checkboxes.
name like:- submit1 ,submit2, and submit 3.
When i select submit1 (mean submit1 is selected ) and click on saved button .
then After saved button it will show Popup Box Msg :- your submit1 is checked and Do you want to Proceeds submit2 ??
Condition :-IF YES, Then I want 2nd submission again It will show Pupup Box Msg your Submit2 is checked.
If No, Then Submission 3 is Automattically Checked.
Again submit2 is checked and clicked in saved button ,It will show message your Submission done Successfully.
Please Help me for this topic.....
I have 3 checkboxes.
name like:- submit1 ,submit2, and submit 3.
When i select submit1 (mean submit1 is selected ) and click on saved button .
then After saved button it will show Popup Box Msg :- your submit1 is checked and Do you want to Proceeds submit2 ??
Condition :-IF YES, Then I want 2nd submission again It will show Pupup Box Msg your Submit2 is checked.
If No, Then Submission 3 is Automattically Checked.
Again submit2 is checked and clicked in saved button ,It will show message your Submission done Successfully.
Please Help me for this topic.....
- Radhika pawar 5
- September 13, 2014
- Like
- 0
- Continue reading or reply
assign different Pagelayout for different workflow
Hey Friend,
I wanted to assign different page layout to user and System Adminisrator after getting mail Process?
I m Creating three Email template for sending mail once creating it.Then After i m assigned workflow .
Eg.sumitted issues
1) Email-your issues that has been Submitted
2)Email-your issues handled by user.
3)Your issus that has been solved.
Now next what i can do for assign page layout once get submitted issues mail?similarly next
I wanted to assign different page layout to user and System Adminisrator after getting mail Process?
I m Creating three Email template for sending mail once creating it.Then After i m assigned workflow .
Eg.sumitted issues
1) Email-your issues that has been Submitted
2)Email-your issues handled by user.
3)Your issus that has been solved.
Now next what i can do for assign page layout once get submitted issues mail?similarly next
- Radhika pawar 5
- August 06, 2014
- Like
- 0
- Continue reading or reply
serch filter for Person name in VF Page
hey Friends .
I want to serch person name with its information in Visualforce page .can you suggest me How is it possible.
I want to serch person name with its information in Visualforce page .can you suggest me How is it possible.
- Radhika pawar 5
- August 06, 2014
- Like
- 0
- Continue reading or reply
How to Export csv file from visual force page
I m to export one particular Export Excel File from VF page
- Radhika pawar 5
- July 31, 2014
- Like
- 0
- Continue reading or reply
Field is not writeable: RI_VOL_THR_INFO__c.RI_School_Card__c
School report card is a parent
teacher is a child
please guide me for this error Field is not writeable: RI_VOL_THR_INFO__c.RI_School_Card__c
Controller:
teacher is a child
please guide me for this error Field is not writeable: RI_VOL_THR_INFO__c.RI_School_Card__c
Controller:
- Radhika pawar 5
- July 21, 2014
- Like
- 0
- Continue reading or reply