Formula Quick Help

Hi guys,

So I am trying to finish off this formula here, I have added a new ‘Habit Status’ type called ‘Bonus’.

What I want the formula to do is when I click the check mark button (on a row with the ‘Bonus’ Habit Status’

  1. Create a new row with the exact same column selections
  2. Modify current row’s ‘Task Status’ to ‘Complete’ AND (the bit I am struggling with) add today’s date into the ‘Do Date’ column for that row.

Please note: all ‘Bonus’ habits don’t have a Do Date, but I want it to add a Do Date when I do the habit (click the button).

For Step 2 above I have tried the Today() function and creating a column ‘Today’s Date’ with the Today() function in it, finally I have tried the ‘Last Modified’ property but again none of these are working :frowning:

If you guys can clarify what I am doing wrong and fix it for me, that would be much appreciated!

Thanks again Coda, and this amazing supportive community for existing :heart:

Here is link :pray: Habits

Just tren hard and eat clen bro

1 Like

You almost forgot - Anavar give up! :joy:

1 Like

Hey @Youssef_Iskander,

Have you tried using the Now() function to define the date when you create the row instead? Or potentially change how you are getting the date in the “Today’s Date” column? I wonder if using “Created On” instead of thisRow.Modified is a better option.

I am still new to formulas myself but figured I’d try to help!

1 Like

Thanks Sarah! I will give that a shot and let you know how it goes :smiling_face:

1 Like

No worries! Yes let me know how it goes :grin:

1 Like

Hi Sarah!

Ok so I have finally sorted it out!

Here is the finished formula (hopefully :joy:)

switchif(
  thisRow.Type = Task AND thisRow.Recurrance.IsBlank(),
  RunActions(
    ModifyRows(thisRow, thisRow.[Task Status], Complete)
  ),
  thisRow.Type = Task AND thisRow.Recurrance.IsNotBlank(),
  RunActions(
    AddRow(
      Tasks,
      Tasks.Task,
      thisRow.Task,
      Tasks.[Do Date],
      thisRow.[Next Due Date],
      Tasks.Recurrance,
      thisRow.Recurrance,
      Tasks.[Task Status],
      Incomplete,
      thisRow.Type,
      thisRow.Type,
      thisRow.Level,
      thisRow.Level,
      thisRow.Notes,
      thisRow.Notes,
      thisRow.Priority,
      thisRow.Priority,
      thisRow.[Habit Routine],
      thisRow.[Habit Routine],
      thisRow.[Habit Status],
      thisRow.[Habit Status]
    ),
    ModifyRows(thisRow, thisRow.[Task Status], Complete)
  ),
  thisRow.Type = Habit AND thisRow.[Habit Status] = Active,
  RunActions(
    AddRow(
      Tasks,
      Tasks.Task,
      thisRow.Task,
      Tasks.[Do Date],
      thisRow.[Next Due Date],
      Tasks.Recurrance,
      thisRow.Recurrance,
      Tasks.[Task Status],
      Incomplete,
      thisRow.Type,
      thisRow.Type,
      thisRow.Level,
      thisRow.Level,
      thisRow.Notes,
      thisRow.Notes,
      thisRow.Priority,
      thisRow.Priority,
      thisRow.[Habit Routine],
      thisRow.[Habit Routine],
      thisRow.[Habit Status],
      thisRow.[Habit Status]
    ),
    ModifyRows(thisRow, thisRow.[Task Status], Complete)
  ),
  thisRow.[Habit Status] = Bonus AND thisRow.Type = Habit,
  RunActions(
    AddRow(
      Tasks,
      Tasks.Task,
      thisRow.Task,
      thisRow.Recurrance,
      thisRow.Recurrance,
      thisRow.[Task Status],
      Incomplete,
      thisRow.Type,
      thisRow.Type,
      thisRow.Level,
      thisRow.Level,
      thisRow.Notes,
      thisRow.Notes,
      thisRow.Priority,
      thisRow.Priority,
      thisRow.[Habit Routine],
      thisRow.[Habit Routine],
      thisRow.[Habit Status],
      thisRow.[Habit Status]
    ),
    ModifyRows(thisRow, thisRow.[Do Date],
      Today(),thisRow.[Task Status], Complete)
  )
)

Essentially what I did is…

  1. I realised that my SwitchIf’s for the Habit status were not logical (they did not cover all options for the variables in the argument e.g. like in the Task arguments at the beginning of the formula - In the Tasks arguments I covered both IsBLank and IsNotBlank. So I changed the first Habit argument by removing the IsBlank argument and instead just made it Status: Active and Type: Habit.
  2. And then I made the final argument - Status: Bonus and Type: Habit (this covered all options as explained in Step 1).
  3. Finally I retried the Now() function on the final argument in the ModifyRows final line and IT WORKED!
2 Likes

Hey @Youssef_Iskander, I’m glad you were able to find a solution!! Just seeing your reply now, hope the project is going well:)

It is moving along slowly but surely! :relieved:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.