select getdate() in DataCompositionScheme query

Common questions about 1C:Query language, Query builder tool and Data composition schema

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

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

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

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.

Download 1.png (40.8 KB)
Download 2.png (26.38 KB)
Download 3.png (38.29 KB)
 
#3
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Jan 18, 2017
Company:

Hello, Kris Lipiński!

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

 
#4
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Apr 8, 2013
Company: 1C Company

Hi, Kris Lipiński,

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

Edited: Anton Chikov - Jan 27, 2017 12:02 AM
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.