Query help: passing dynamic date parameter

can this be dynamic?
Am I just doing it wrong?

Are you using SQL syntax in the query parameters? I don’t think you can. You have to use expression functions.



I am not seeing how to convert to datetime in the expression language

I am trying dateFormat() with MM/d/YYYY now

Why use parameters? Can’t you do what you showed directly in the query?

Youu up will to do this in the query itself.

In your case it would be:

DATEADD(month, -5, :StartTime)


The screen shot looks like your trying to do that in the testing tab of a named query. I don’t think that was ever intended to work with anything other than an actual value. I’m not sure why your trying to be dynamic with it since that tab is just for testing. As soon as you close the named query, the value will clear out. It doesn’t save it as a default value. When you go to use a named query in your project, you will always need to provide it with those values. Depending on where you call it from you may be able to use an expression or a script function. If you don’t want to have to fill in variables when you go to run the query and your not looking to be able to change the dates in through another method, then you should hard code the DateTime items in your query.

1 Like

I wanted to send dynamic values from a dropdown

You can do that but that is setting up your expression on the your vision/perspective view instead of in the named query test screen.

I wanted to test it though haha

I’d just build a simple test screen and do it there. Depending on what I was putting on the screen I would probably set up custom properties on the drop down and do my expression right there then just bring the values into where your doing their query. Don’t know if your going to use it in a table or something else.

1 Like