Forum Discussion

Ganeshk12's avatar
Ganeshk12
New Contributor
19 days ago

Dashboard - load issue (default parameter value)

 

Hi, All - 

I’ve developed a dashboard that includes a text box, parameter components, and other elements. Users can input a date and click a trigger button to fetch the data, using inbound parameters in the data adapter.

The dashboard is supposed to default to a date value upon loading, but it’s not pulling the expected default from the parameter.

Ideally, the dashboard should open without any issues, but instead, it’s throwing the following SQL error:

"Conversion failed when converting date and/or time from character string. (SQL Error Number -2146232060, 241)"

Currently, the dashboard is not opening and displays the error above.

The data adapter field value format for date is as shown below.

I’ve tried various options for setting the default value in the dashboard parameter, but the issue persists. 

Please let me know if you have any suggestions. thank you !

 

 

 

 

  • sameburn's avatar
    sameburn
    Contributor II

    Hi Ganeshk12

    I think the issue is your sql statement? Since this is a generic sql error

    To fix, try to pass in your parameter like this instead.. 

    CAST('|!logonThreshold!|' AS DATETIME)

    Thanks

    Sam

    • Ganeshk12's avatar
      Ganeshk12
      New Contributor

      Hi sameburn  - Thank you

      I have updated the query like this still having an issue and will try the one you suggested. thank you !

       

              SELECT 
                  Username, 
                  MAX(LastLogonTime) AS LastUpdatedDate 
              FROM 
                  UserLogonStatus 
              WHERE 
                  LastLogonTime <= CONVERT(DATETIME, '|!logonThreshold!|')
              GROUP BY 
                  Username

       

       

      • rhankey's avatar
        rhankey
        Contributor

        I think the problem is that |!logonThreshold!| is not being replaced with the date/time.  Temporarily replace that parameter with the 1/1/1900 12:00:00 AM and confirm it works, as it appears it should.

        If the above test does work, then you can move on to figuring out why the dashboard parameter is not being replaced, or is being replaced with some other text string that cannot be resolved to a date/time.

        The dashboard parameter will only be substituted if the Adapter is set to CommandType=SQL.  And when you run the adapter, it should display the SQL statement before and after parameter subsitution.

        If you are issuing the SQL statement from within a Business Rule, it is on you to take care of constructing the SQL statement with any runtime variables.