Auto populate date field based on separate fields value

Issue #521 resolved
Scott McDonald created an issue

Is this use case possible within the tool?

Auto populate a "Date" field based on a Risk Rating (separate field with separate value). A user needs the ability to enter their own planned completion date. If no values are entered, then the default timelines can be populated.

Here is how Security is currently proposing timing: High Risks (values 20-25) - 3 months Med/High and Medium (values 9-19) - 6 months Med/Low and Low (values 1-8) - 1 year

Comments (9)

  1. Fidel Castro Armario repo owner

    Hi Scott,

    You can do it using "Set a field as a function of other fields" post-function with a configuration like this one:

    1) Field to be checked for matching...: it doesn't matter the value selected, since we are going to use type 2 setting rules.

    2) Target field: the Date field we want to set.

    3) Setting rules:

    [{nnnnn} >= 20 AND {nnnnn} <= 25]{00057} + 3 * {MONTH}
    [{nnnnn} >= 9 AND {nnnnn} <= 19]{00057} + 6 * {MONTH}
    [{nnnnn} >= 1 AND {nnnnn} <= 8]{00057} + 1 * {YEAR}
    

    replacing nnnnn with field code for Risk Rating, which I'm assuming it's a number field. Note that {00057} is field code for Current date and time

    4) Conditional execution:

    {ddddd} = null
    

    replacing ddddd with field code for field the Date field we want to set.

  2. Scott McDonald reporter

    Hi Fidel -

    Risk Rating is indeed a text field, however it's the field Risk Rating will be set according to the evaluation of Inherent Risk (Calculated). Does that have anything to do with the error message I'm receiving below?

    ERROR IN RULE 1: [{14224} >= 20 AND {14224} <= 25]{Current date and time} + 3 * {MONTH} ERROR IN RULE 2: [{14224} >= 9 AND {14224} <= 19]{Current date and time} + 6 * {MONTH} ERROR IN RULE 3: [{14224} >= 1 AND {14224} <= 8]{Current date and time} + 1 * {YEAR} Post-function will only be executed if the following boolean expression is satisfied: {14224} = null >>> PARSE ERROR: "{14224}" is not a valid Number or Date field identifier.

    Here's the setting rules I'm using:

    [{14224} >= 20 AND {14224} <= 25]{00057} + 3 * {MONTH} [{14224} >= 9 AND {14224} <= 19]{00057} + 6 * {MONTH} [{14224} >= 1 AND {14224} <= 8]{00057} + 1 * {YEAR}

  3. Fidel Castro Armario repo owner

    Try this one:

    [toNumber(%{nnnnn}) >= 20 AND toNumber(%{nnnnn}) <= 25]{00057} + 3 * {MONTH}
    [toNumber(%{nnnnn}) >= 9 AND toNumber(%{nnnnn}) <= 19]{00057} + 6 * {MONTH}
    [toNumber(%{nnnnn}) >= 1 AND toNumber(%{nnnnn}) <= 8]{00057} + 1 * {YEAR}
    

    I'm assuming that Risk Rating is a text field containing a number.

  4. Scott McDonald reporter

    Looks like it converted the field code to risk rating

    [toNumber(%{Risk Rating}) >= 20 AND toNumber(%{Risk Rating}) <= 25]{Current date and time} + 3 * {MONTH} [toNumber(%{Risk Rating}) >= 9 AND toNumber(%{Risk Rating}) <= 19]{Current date and time} + 6 * {MONTH} [toNumber(%{Risk Rating}) >= 1 AND toNumber(%{Risk Rating}) <= 8]{Current date and time} + 1 * {YEAR} Post-function will only be executed if the following boolean expression is satisfied: {14224} = null >>> PARSE ERROR: "{14224}" is not a valid Number or Date field identifier.

    then conditional execution is: {14224} = null

  5. Scott McDonald reporter

    Perhaps that's the issue, Risk Rating does not contain a number, it contains a value of either High, Medium-High, Medium, Medium-Low or Low

  6. Scott McDonald reporter

    Ok, it looks like I was able to remove the error by using a different field but I can't get the field to populate with a date.

    The field Planned Completion Date will be set according to the evaluation of Risk Rating against the following set of rules: [{Total Risk Score (Calculated)} >= 20 AND {Total Risk Score (Calculated)} <= 25]{Current date and time} + 3 * {MONTH} [{Total Risk Score (Calculated)} >= 9 AND {Total Risk Score (Calculated)} <= 19]{Current date and time} + 6 * {MONTH} [{Total Risk Score (Calculated)} >= 1 AND {Total Risk Score (Calculated)} <= 8]{Current date and time} + 1 * {YEAR} Post-function will only be executed if the following boolean expression is satisfied: {Total Risk Score (Calculated)} = null This feature will be run as user in field Reporter.

  7. Fidel Castro Armario repo owner

    Try using the original field with "Set a field as a function of other fields" post-function using the following configuration:

    1) Field to be checked for matching...: Risk Rating

    2) Target field: Planned Completion Date

    3) Setting rules:

    (High){00057} + 3 * {MONTH}
    (Medium-High|Medium){00057} + 6 * {MONTH}
    (Medium-Low|Low){00057} + 1 * {YEAR}
    

    4) Conditional execution:

    %{nnnnn} = null
    

    replacing nnnnn with field code for Risk Rating.

    If it keeps not working try leaving empty paramer Conditional execution.

  8. Log in to comment