I have 2 fields that I am trying to calculate the difference between however one of the fields may be null for some records so I am using a 'if,then,else' formula as follows:
if isnull({Requests for Information.RFI~DateResponded}) then
{Requests for Information.RFI~DateCreated}-currentdatetime
else {Requests for Information.RFI~DateResponded}-{Requests for Information.RFI~DateCreated}
NOW the user wanted to calculate the difference in Business Days so I copied a formula from a previous post and replaced it with my fields however it won't let me use the 'else' part of my formula above.
Here is the new formula I am trying to use:
if isnull({Requests for Information.RFI~DateResponded}) then
//Subtracting Business Days:
//Main formula
WhileReadingRecords;
Local DateVar Start = {Requests for Information.RFI~DateCreated}; // place your Starting Date here
Local DateVar End = currentdatetime; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
else
WhileReadingRecords;
Local DateVar Start = {Requests for Information.RFI~DateResponded}; // place your Starting Date here
Local DateVar End = {Requests for Information.RFI~DateCreated}; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
HELP PLEASE!!!
if isnull({Requests for Information.RFI~DateResponded}) then
{Requests for Information.RFI~DateCreated}-currentdatetime
else {Requests for Information.RFI~DateResponded}-{Requests for Information.RFI~DateCreated}
NOW the user wanted to calculate the difference in Business Days so I copied a formula from a previous post and replaced it with my fields however it won't let me use the 'else' part of my formula above.
Here is the new formula I am trying to use:
if isnull({Requests for Information.RFI~DateResponded}) then
//Subtracting Business Days:
//Main formula
WhileReadingRecords;
Local DateVar Start = {Requests for Information.RFI~DateCreated}; // place your Starting Date here
Local DateVar End = currentdatetime; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
else
WhileReadingRecords;
Local DateVar Start = {Requests for Information.RFI~DateResponded}; // place your Starting Date here
Local DateVar End = {Requests for Information.RFI~DateCreated}; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
HELP PLEASE!!!