Bardate() does to be missed in if statement

Optuma Forums Optuma Scripting Bardate() does to be missed in if statement

This topic contains 2 replies, has 2 voices, and was last updated by Avatar Mario 4 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #52861
    Avatar
    Mario
    • Topics: 12
    • Replies: 17
    • Posts: 29

    Hello,

     

    I am writing a script and testing the bardate() function, but it does not seem to be picking up the date correctly.

     

    v2 = if( bardate() = 32875, 700,0);

    plot0 = v2;

     

    If you look at the below screenshot, I would only expect a single line plotted on 2 Jan 1990, however, it seems to ignore the date criteria  bardate() = 32875, and plots 700 sporadically, have I set the parameters correctly? I would expect it to plot 0, for all dates except the date = 32875 (2 Jan 1990).

     

    Thanks in advance.

     

     

    OptumaScreenshot

     

     

    #52863
    Mathew
    Mathew
    • Topics: 16
    • Replies: 1,035
    • Posts: 1,051

    Hi Mario,

    Remember that when you are comparing something, you need to use the double equals (==). When you use one you are trying to assign 32875 to bardate() which can not be done.

    make it v2 = if( bardate() == 32875, 700,0);

    All the best

    Mathew

     

    #52871
    Avatar
    Mario
    • Topics: 12
    • Replies: 17
    • Posts: 29

    Thanks Matthew!  Will update my code 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close