If loop

Viewing 5 reply threads
  • Author
    Posts
  • February 24, 2023 at 7:32 PM #49026

    Glen Forister
    Participant

    I thought this would work. Some of my tools I don’t have a date of purchase, so I thought the end result should be 0 or blank, not 51 years. The result is a blank field.

    I have fields Purchased = (date), Today = (date).

    
    IFNOTEMPTY(Purchased; (YEARS(Purchased;Today;)) )
    
    • This topic was modified 2 years, 2 months ago by Glen Forister.
    February 25, 2023 at 10:56 AM #49031

    Brendan
    Keymaster

    Hi Glen,

    You have an extra semicolon after today and you’re forgetting the () in TODAY().

    And you also have a parenthesis before YEARS which is not required. And then you don’t need 3 at the end.

    February 25, 2023 at 10:59 AM #49032

    Brendan
    Keymaster

    Also, what does this have to do with looping? Just curious. Oh, also you need an else part of the expression.

    The IFNOTEMPTY() function takes 3 parameters.

    IFNOTEMPTY(Purchase; YEARS(Purchased; TODAY()); 0)

    or something like that. I don’t know what you want to return if Purchased is empty.

    February 25, 2023 at 11:09 AM #49034

    Glen Forister
    Participant

    It works, but as I feared, I notice these equations return integers, not actual decimal numbers indicating parts of an integer. I guess I have to do this in Script to get a real value???

    I was able to get YEARS AND MONTHS, but not a real value, just an approximated value. Number Format is decimal with 2 places.

    See pic attached.

    Attachments:
    You must be logged in to view attached files.
    February 25, 2023 at 11:14 AM #49038

    Brendan
    Keymaster

    Your formula from your screenshot is invalid. You’re missing semi-colons and you have a subtract character in there.

    February 25, 2023 at 12:53 PM #49042

    Glen Forister
    Participant

    Please look at my earlier comment I was creating when you were posting a problem I was fixing.

Viewing 5 reply threads

You must be logged in to reply to this topic.