VAD EXPRESSION - NOW()

Discussion in 'CRM / Helpdesk / App Integration' started by SWSDEV, Oct 9, 2009.

Thread Status:
Not open for further replies.
  1. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    I am finding that the NOW() function is not returning anything at all.

    Am I supposed to put something in between the parenthesis in the function?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    I have tried to use the VAD's NOW function in assigning a value to a date field in a database and it simply will not work, and crashes the call flow every time. I have tried assigning hte NOW function to a variable as well. I have tried with the datatype in the database as both a datetime and a varchar. I have tried many different possible syntaxes. My final workaround was to not use the VAD, but to just put a trigger on my table to update my field to timestamp the creation of the record. IT works but it doesn't use the VAD at all.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Where are you calling the NOW() function? If you're trying to insert the current date and time into a database, you should use the database syntax for that. For example, if you're using SQL Server, you should use GETDATE(). If you want to use NOW(), have in mind that the return value will be treated as a string, so if your database field is a datetime you will need to convert it. Also, the SQL statement should have quotes rounding the parameter.

    For example, using GETDATE:
    insert into TABLE (DateField) values (GETDATE())

    Using NOW():
    insert into TABLE (VarcharField) values ('{0}')
    having a parameter with value NOW()

    If you do not use quotes in the SQL statement, you will have a runtime error.

    Let me know if this helps.
     
Thread Status:
Not open for further replies.