Date listed only if recurr

Viewing 7 reply threads
  • Author
    Posts
  • February 7, 2023 at 11:41 AM #48857

    Glen Forister
    Participant

    I have a journal that has items that need a date listed for when It should recur next.

    I don’t want a value in that field unless the checkbox “Recur” is checked.
    Does this take script or can it be done with an if statement.

    I just wanted to know before I made a new Form to play with because I know I’ll lose all my data if I play with this one.

    February 7, 2023 at 1:26 PM #48859

    Brendan
    Keymaster

    Hi Glen,

    You can do this with a Calculation field set to return a Date value.

    IF(CheckmarkField = 1; TODAY(); NULL)

    I don’t know what actual Date value you want to return, but something like the above will work. A Checkmark field will return 0 if off and 1 if on. So just return the date you want if the Checkmark field is on and NULL if it’s off.

    February 7, 2023 at 4:58 PM #48862

    Glen Forister
    Participant

    OK, lets see if I understand.
    The TODAY() you refer to is actually a field that I had entered in the date that the event actually had occurred.
    So, If I do what you suggest, I assume I leave that field (Due-Date) information alone or it will get wiped out.
    Then I create another field to put your formula in.
    Then I will have 2 fileds showing, one with stuff I don’t want to see and one with what I want. But I have to ender the data into the filed I don’t want to see?
    That doesn’t really work.

    I tried adding a field just to play with it and I get a long number with the field set to DATE properties.
    I don’t think I accomplished anything here.

    February 7, 2023 at 7:56 PM #48863

    Glen Forister
    Participant

    I tried again with this:

    Due-Date Field, Calc; IF (Recur = 1; ((Orig-event Date) + (Interval-Days)); NULL)
    In this window the field is set to DATE (I think I forgot that before).

    Now, I get a date for the result.
    But, in one record,
    Orig-event Date = Nov 16, 2022
    Interval-Days = 120
    Due-Date = 16-11-2022. This is the end result of my calc from above.

    Due-Date is wrong. Maybe I’m getting there, but still???

    Result should be: Mar 16, 2023 at 12:00 AM. (still can’t get rid of time).
    I got this result using this formula:
    DATEADD( Orig-event Date;0;0;0; Interval-Days;0;0;0)

    Should I use the this formula in the IF STATEMENT? TRIED BUT FAILED. LOOK AGAIN TOMORROW.

    February 8, 2023 at 12:50 PM #48864

    Glen Forister
    Participant

    Tried if: Now I get a blank for a result instead of “Date” as selected in the “Result Type”.
    IF(Recur =1;(DATEADD (Orig-event-Date;0;0;0;Interval-Days;0;0;0);NULL)

    Orig-event-Date = the var for date the event happened.
    Interval-Days = var for the # of days I’ve entered for the duration before I want it to happen again.

    February 8, 2023 at 4:18 PM #48865

    Daniel Leu
    Participant

    You have three opening brackets but only two closing brackets. They should be balanced.

    It looks like the second opening bracket is not needed:

    IF(Recur =1;DATEADD(Orig-event-Date;0;0;0;Interval-Days;0;0;0);NULL)

    February 8, 2023 at 5:05 PM #48866

    Glen Forister
    Participant

    Wow, taking out that bad bracket made it work and give a date.
    And, it is the right date.

    I’ve always been bad with if statements when I was programming. At least I got the logic right this time.

    February 8, 2023 at 6:50 PM #48867

    Daniel Leu
    Participant

    Great that you got it working!

Viewing 7 reply threads

You must be logged in to reply to this topic.