function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neshnesh 

How to reduce Compiled size in Formula field ..OR How to use this logic in apex code .

I have got error :Error: Compiled formula is too big to execute (6,715 characters). Maximum size is 5,000 character.

My requirement is:

Calculate scores based on selection  checkbox:

Visualforce page:

        

     question               P - 0                       p--1                 p--2                 p--3             p--4

A                                  chechkbox           chechkbox

C

D

E

F

G

H

I

J

L                           chechkbox               chechkbox                                                   chechkbox

 

:(Sample for first question formula field name is A)

A=.IF(P0__c = true , 0 , 
   IF(p1__c = true , 1 , 
  IF(p2__c= true , 2 , 
   IF(p3__c= true , 3 , 
    IF(p4__c = true ,4 , null )))))

I have created  formula field  for  12 Questions (A to L) LIKE ABOVE

Then created  total formula field ---Total =A__c+B__c+C__c+D__c+E__c+F__c+G__c+H__c+I__c+J__c+K__c+L__c..

This is the my requirement . But i have got Error: Compiled formula is too big to execute (6,715 characters). Maximum size is 5,000 characters.How to reduce Compiled size in Formula field ..OR How to use this logic in apex code .Please give ur idea For this task.I dont want to work flow field update process. because i want to update existing record also..

Vinita_SFDCVinita_SFDC

Hello,

 

In such sitiuations a trigger or workflow field update is recommended but as you wish to calculate it on existing records as well, the only option left is break down the formula in to two formula fields.

 

Please refer following help link for all possible options to overcome this error:

 

https://help.salesforce.com/apex/HTViewSolution?urlname=Formula-field-exceeds-maximum-number-of-characters-1327109401516&language=en_US