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
T-HanT-Han 

Code for this Formula

Hi Y'all who'll be assisting me..!

 

I have this below code, I tried using in Formula but unable to save due to the size thing.

I am pretty new to coding and I would like to know how to come up with a code and like what to do.

 

CASE(MOD((X3_Date_Copy__c) - DATE(1900, 1, 7) , 7),
0, X3_Date_Copy__c+Stage_3_4__c,
1, X3_Date_Copy__c+Stage_3_4__c,
2, X3_Date_Copy__c+Stage_3_4__c,
3, X3_Date_Copy__c+Stage_3_4__c,
4, X3_Date_Copy__c+Stage_3_4__c,
5, X3_Date_Copy__c+Stage_3_4__c,
6, X3_Date_Copy__c+Stage_3_4__c,
null)

 

X3 and Stage3_4 are both Formula Fields. As a result the formula is heavy.

 

My Scenario: I hv X3 which is a calculated date and S3_4 is a calculated number - Formula Field Types.

 

I need to know how to write a code for above scenario. After this I have 3 more places I would have to implement the same code for same scenarios but different values.

 

Need assistance pls.!

 

Thanks,

Vinit_KumarVinit_Kumar

I need to see the formula for X3_Date_Copy__c and Stage_3_4__c in order to help.Also,make your requirement clear,then it would be easier for me.

T-HanT-Han

I had to make a few changes but this will be static from now on...

 

The Below Formula:

------------------------------------------------------------------------------------------------------------------------------------------------------------------

FR4__C

 

CASE(MOD((UW__C) - DATE(1900, 1, 7) , 7),
0, UW__c+X80_Calc_Number__c,
1, UW__c+X80_Calc_Number__c,
2, UW__c+X80_Calc_Number__c,
3, UW__c+X80_Calc_Number__c,
4, UW__c+X80_Calc_Number__c,
5, UW__c+X80_Calc_Number__c,
6, UW__c+X80_Calc_Number__c,
null)

------------------------------------------------------------------------------------------------------------------------------------------------------------------

The below code is to check if the above formula does not fall into a weekend.

 

FR__C

 

CASE( MOD( FR4__c - DATE(1900, 1, 7), 7),
0, 1,
6, 2,
0)
+FR4__c

------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total of 10 Date Fields:

 

S-RR__C               E-RR__C

S-IR__C                 E-IR__C

S-UW__C              E-UW__C

S-FR__C                E-FR__C

S-AD__C                E-AD__C

 

S indicates Start and E indicates End Dates..

------------------------------------------------------------------------------------------------------------------------------------------------------------------

(Formula field) X80_Calc_Number__c = 0.8* Stages_3_5__c

(Formula field) Stages_3_5__c = Total_Days__c - 1

(Formula field) Total_Days__c = A formula code to find difference between 2 dates and calculates the weekdays alone.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

E-RR__C, E-IR__C are calculated as Standard (1+S-RR__C)

 

E-UW__C - is a date field which is calculated as E-IR__C+X80_Calc_Number__c

E-FR__C -  is a date field which is calculated as E-E-UW__C+X80_Calc_Number__c

E-AD__C - is a date field which is calculated as E-FR__C+X80_Calc_Number__c

------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

I know this is pretty big and I was trying to fit it by using all possible WF,Formula but nothin seems to work. I guess it time to start learning the Coding which i hv been avoiding.

 

I really appreciate if you could shed some light on this fr ME.

 

Thanks.