Apply Formulas to Columns in a Table
Please help. I have a table of data where I want to apply some simple formulas to update fields within the table.
1. If AccountsAlertedDT is blank and Active = Yes, I want to update AccountsAlertedDT to the Run Start Date.
2. If AccountsAlertedDT is not blank and Active = Yes, I want to update Last Update to the Run Start Date.
What's the best way to do this?
Best Answers
-
Hi @Adam_636382, I believe this is the formula you're looking for:
if (!columns["AccountsAlertedDT"] && columns["Active"] == "Yes") { columns["AccountsAlertedDT"] = run["startDate"]; } else { if (columns["AccountsAlertedDT"] && columns["Active"] == "Yes") { columns["Last Update"] = run["startDate"]; } }
A couple notes on how this is working:
- To check that a column is not blank, you can just include the reference to the column in the IF condition, as you see in the second IF statement with the reference to
columns["AccountsAlertedDT"]
. - In the first IF statement, the
!
beforecolumns["AccountsAlertedDT"]
meansNOT
, so it evaluates to True if that column is blank. - The
Run Start Date
is a special field. To reference it in a formula, enterrun["startDate"]
.
5 - To check that a column is not blank, you can just include the reference to the column in the IF condition, as you see in the second IF statement with the reference to
-
@Adam_636382 When referencing fields in formulas, you'll want to use this syntax:
fields["filter-range"]
5
Answers
-
Thanks Jeff - this is helpful!
Follow up question. If I am also trying to apply a formula that includes a field output from a different step, do I need to reference that a particular way?For example: I have a step that converts the Run Start Date by -30 minutes into a field called "filter-range". I want to apply a formula using that field.
0