Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Query language and DCS > select getdate() in DataCompositionScheme query

Forum

Search UsersRules
select getdate() in DataCompositionScheme query
#1
Active user
Points:: 0
Joined:: Sep 18, 2012

Hello everybody,
MS SQL allows to get current date in query this way: "select getdate()". In 1C query it doesn't work. I need to get current date in DataCompositionScheme query and I don't know how to do it. Function CurrentDate() doesn't work in queries, only in scripts.
I know that in queries I can use parameters, for example:

Code
Query.Text = "select &getdateparameter";
Query.SetParameter("getdateparameter",CurrentDate())

but is it possible to do the same in DataCompositionScheme query? I can't see such a possibility.
Thank you in advance for your help,
Kris

Profile
#2
Guest
Points::
Joined::

Hello, Kris Lipiński!

You can use parameters in data composition schema too.
If you specify it in query that you use as data source in data composition schema, they will appear on the Parameters tab. There also will be built-in parameters used to filter data in periodic registers.

On the Parameters tab you can set value (the Value column) if this parameter is static, but usually you would like parameters to be changeable by user. In this case you need to clear check boxes in the Availability restriction column.

Then you can specify default values for parameters, for example, beginning of this week or beginning of this day in your case on the Parameters tab of the Settings tab.

Profile
#3
Just came
Points:: 0
Joined:: Jan 18, 2017

Hello, Kris Lipiński!

Also, on the Parameters tab you can use global context function CurrentDate() (the Expression column).

Profile
#4
Just came
Points:: 0
Joined:: Apr 8, 2013

Hi, Kris Lipiński,

I recommend using CurrentSessionDate() instead of CurrentDate() as shown in our Best practices to avoid any issue with time zones.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.