Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
1
Indexable
Never





If (SelectedTimeRange.ValueId = 3) then
  Step = 1       // Display every day for the last 7 days
Else If (SelectedTimeRange.ValueId = 4) then
  Step = 3       // Display 10 points for the last 30 days
Else If (SelectedTimeRange.ValueId = 5) then
  Step = 9       // Display every 9th day for the last 90 days
End If

NumberOfDays = 0

// Calculate the total number of days based on the SelectedTimeRange.ValueId
If (SelectedTimeRange.ValueId = 3) then
  NumberOfDays = 7
Else If (SelectedTimeRange.ValueId = 4) then
  NumberOfDays = 30
Else If (SelectedTimeRange.ValueId = 5) then
  NumberOfDays = 90
End If

TotalUsersStartDate = AddDays(CurrDate(), -1 * (NumberOfDays - 1))

Counter = 0
For i = 0 to NumberOfDays - 1
  // Calculate the date to be added
  NewDate = AddDays(TotalUsersStartDate, Counter)

  // Check if the Counter is a multiple of the Step value and if the date is not in the future
  If (Mod(Counter, Step) = 0 and NewDate <= CurrDate()) then
    // Add the date points according to the step value
    ListAppend NewDate
  End If

  Counter = Counter + 1
End For