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

#1
People who like this: 0 Yes / 0 No
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: 0 Yes / 0 No
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: 0 Yes / 0 No
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: 0 Yes / 0 No
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.

/* --- ФИКС ЗАГОЛОВКОВ ДОКУМЕНТАЦИИ (BRUTE FORCE) --- */ /* Цепляемся за все возможные контейнеры Битрикса */ .content h1, #content h1, .workarea h1, .content h2, #content h2, .workarea h2, .content h3, #content h3, .workarea h3, .content h4, #content h4, .workarea h4, .content h5, #content h5, .workarea h5, .content h6, #content h6, .workarea h6 { display: block !important; font-weight: 700 !important; color: #222 !important; text-transform: none !important; margin-top: 1.5em !important; margin-bottom: 0.5em !important; line-height: 1.2 !important; } /* Явно задаем размеры, чтобы перекрыть "font-size: 100%" */ .content h1, #content h1 { font-size: 28px !important; } .content h2, #content h2 { font-size: 24px !important; } .content h3, #content h3 { font-size: 22px !important; } .content h4, #content h4 { font-size: 20px !important; } .content h5, #content h5 { font-size: 18px !important; } /* Ваш случай (5 решеток) */ .content h6, #content h6 { font-size: 16px !important; } /* Если Битрикс или редактор засунули внутрь h5 тег span или font */ .content h5 *, #content h5 *, .workarea h5 * { font-size: inherit !important; color: inherit !important; font-weight: inherit !important; } /* --- СТИЛИЗАЦИЯ ТЕКСТА (Markdown Style) --- */ /* Ссылки в тексте делаем более заметными */ .content a:not([class]) { color: #005aa0; text-decoration: none; border-bottom: 1px solid rgba(0, 90, 160, 0.2); } .content a:not([class]):hover { border-bottom-color: #005aa0; } /* Списки (чтобы не прилипали) */ .content ul, .content ol { margin-bottom: 15px !important; padding-left: 20px !important; } .content li { margin-bottom: 5px !important; }