+ Start a Discussion
sfbatchsfbatch 

TYPICAL FORMULA IN CASE HANDLING

Hi Guys can anyone please help(explain) me the following formula. As I have very basic knowledge, it is hard to me understand the formula. We are using this formula in case management system. Here FLAGS__ViewedFlag__c is Date/Time field(object type). Please explain me how it works.

Thanks in advance.
RPAD(
RPAD(
RPAD(
text(CASE(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2))),
13,13,
12,13,
11,13,
10,13,
9,13,
8,13,
7,13,
6,13,
5,22,
4,22,
3,22,
2,22,
1,22,
0,22,
24,22,
23,22,
VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))))
,3,":"),
5,
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))>=22,
'00',
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))<13,
'00',
TRIM(RIGHT(TRIM(LEFT(TEXT(FLAGS__ViewedFlag__c),16)),2))))),8,
':00')))
ShashForceShashForce
Not perfectly, but the formula is taking the "hour" value of the date/time field, and outputting time as 13:00 for anytime between 6:00 and 13:00 hours, and as 22:00 for anytime between 23:00 and 5:00.

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank