0

Set Date Field with a choice Field is Made

I have a choice field for project status (Open, Pending, Closed) and I have a date field "Closed Date".

I want the "Closed Date" Field to update with the current date when the project status field is changed to Closed(3).

I have tried 

if 'Date Closed' = 0 and 'Project Status' = 3 then
'Date Closed' = 'Date Created'
end

Any ideas why this does not work?   Is  if 'Date Closed' = 0 correct for testing an empty date field?

6 replies

null
    • jfordpico
    • 5 yrs ago
    • Reported - view

    Update

    The code I have tried should have read

    if 'Date Closed' = 0 and 'Project Status' = 3 then
    'Date Closed' = 'Today'
    end

    • Ninox developer
    • Fabio
    • 5 yrs ago
    • Reported - view

    Hi.

    The syntax for 'Date Closed' should be "void" or "null".

    Try this:

    ------------------------------------

    if 'Date Closed' = null and 'Project Status' = 3 then

    'Date Closed' := today()

    end

    ------------------------------------

     

    Fabio

    • jfordpico
    • 5 yrs ago
    • Reported - view

    Works Great. Thanks.

    Do you know if there is a good code language reference for Ninox?

    What language syntax is Ninox based on?

    • Ninox developer
    • Fabio
    • 5 yrs ago
    • Reported - view

    Hi.. the best source is the function and language reference in the manual.
    Ninox has its own syntax which is a functional language: the core system is based on Javascript.

    • jfordpico
    • 5 yrs ago
    • Reported - view

    Thanks,   I have enjoyed this program so far.  One of the best to be mobil on IPad and PC Desktop.

    • Tim
    • 5 yrs ago
    • Reported - view

    BTW, if you want to make your code a bit more readable, you can compare choice field values with text using 'like', as in:

    ------------------------------------

    if 'Date Closed' = null and 'Project Status' like "Closed" then

    'Date Closed' := today()

    end

    ------------------------------------

Content aside

  • 5 yrs agoLast active
  • 6Replies
  • 2097Views