-1

i have a requirement like this,in my working project,

for (Sobject aggregrate: aggregratecountList) {
            totalCount = Integer.valueOf(aggregrate.get('ID'));
            break;
        }
percent = decimalaggregate.Divide(totalCount, 2);

the percentage is showing as 50: instead of 100,

3
  • pls suggest me how to do it''
    – Satya
    Commented Apr 25, 2016 at 11:06
  • how to calculate the percentage of total records using id.
    – Satya
    Commented Apr 25, 2016 at 11:06
  • 2
    It is not quite clear to me what you're asking. The subject mentions 'count of ids', one of your comments mentions 'percentage' and your code divides by 2. I would suggest editing your own question to indicate what your requirements are, what you've tried, and what doesn't work. That's the best way to get help from this community.
    – mkorman
    Commented Apr 25, 2016 at 11:49

1 Answer 1

1

you only created Divide method in decimalaggregate class and called it

   decimalaggregate.Divide(totalCount, 2).

You get some if using SOQL get their count, and get total no of records of that data type existing in the system.

then just put them in simple percentage formula.

1
  • yes am trying in different ways,if i put write divide also am not not getting 100:%'
    – Satya
    Commented Apr 25, 2016 at 11:17

Not the answer you're looking for? Browse other questions tagged .