Sorry was out yesterday with a sick little one.
Here is what I got.
One of the following for each Quarter which is used as a column in a cross tab
//{@Qtr1}:
if {@qtrst} = 1 then
{@dayscurrqtr} else
if {@qtrend} = 1 then
{@daysnextqtr}
One of these for quarter 2, 3, and 4
//{@qtr2total}
numbervar qtr2total:= {@Qtr2} + {@Qtr2mid}
//@{Qtr2mid}
if {@qtrmid1} = 1 then
{@daysoutofqtr} else
if {@qtrmid2} = true then
{@daysoutofqtr};
This checks to see if the length of stay was 3 quarters another will check for 4.
//{@qtrmid1}:
datevar start := {VIEW.STARTN_DATE};
numbervar days := {VIEW.LENGTH_OF_STAY};
datevar end := start + days-1;
numbervar midqtr1 := 0;
numbervar quarter := 0;
if datepart("q", end) - datepart("q",start) = 2 then
midqtr1 := 1;
This one sends back the number of days in a quarter. Problem is depending on what quarter is calling this formula I want to do some different logic with it. Ie. If the middle quarter is 2, then it will still add 92 days to the third quarter even though its the last quarter of the formula and won't have someone staying the full duration of the quarter, may only have 10 days used but will send back 102 days.
//{@daysoutofqtr}
datevar start := {VIEW.START_DATE};
numbervar days := {VIEW.LENGTH_OF_STAY};
datevar end := start + days-1;
numbervar dysoutofqtr := 0;
if datepart("q", end) - datepart("q",start) = 2 then
dysoutofqtr := {@daysonemidqtr}
else if datepart("q", end) - datepart("q",start) = 3 then
dysoutofqtr := {@daysonemidqtr}
else if datepart("q", end) - datepart("q",start) = -1 then
dysoutofqtr := 0