Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
d.sureshkumar41.33978150573839

Hi I want to create one vf page in that i want to show one table with two columns and those are lead owner and ratio of proposed leads by capped leads.

suppose in a day 10 leads are created in that first owner have  2 are proposed leads and  1 capped lead then we show the ratio of  2/1 for that owner and second owner have 3  proposed leads and 2 capped leads we show the ratio of  3/2 and third owner have 2 proposed leads and 0 capped leads we show the ratio N/A.

PLZ help me.

raseshtcs
You should follow the below steps
1) Query all the leads created today and store it in map of owner id and list of leads.
2) Loop through the map.keyset and then loop through the leads for that lead owner and calculate the ratio there.
3) put in the ratio and the owner in another map of type id and decimal.
4)Use this map to print the values on the VF page.
d.sureshkumar41.33978150573839

Thank You .I tried with those steps .

raseshtcs
Did it help? If yes then please mark it as a solution for future users
d.sureshkumar41.33978150573839

I queried on all leads and put it in map first is k .

the code is

public class CLS_submit {

public integer i{get;set;}
public integer j{get;set;}
public decimal k{get;set;}

public CLS_submit(ApexPages.StandardController controller) {

{

}

{

}

I cant understand the second step PLZ help me.

raseshtcs
//We need a map of id and list of leads as there can be multiple leads for an owner.
}
else{
}
}
//This way you have map which has lead owner as key and all the leads it owns as value

//Logic to calculate the ratio comes here eg u store the ratio in variable x;
ratiomap.put(i,x);//Use this for the VF page
}
}
raseshtcs
ratiomap is a map which has owner id as the key and ratio as the value for that owner
d.sureshkumar41.33978150573839

here the problem is we want to show lead owner name not id then in the map in place of id i take string but it didn,t allow duplicates PLZ resolve this issue.

raseshtcs
Please post the code which you used for the string. Basically now you have the id of the owner and the ratio. You can now manipulate that with whatever you need. You can also create a map with the user object instead of id and then use obj.name to get the user name.