Selected data in documents code prefix

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 2, 2019
Company:

Dear all,
I would like to know if there is any way to put month and day numbers in documents prefix.
For example, if selected date is 03.12.2019 then prefix should be DOC/0312/00001+(1). I want to know how to get DD(03) and MM(12) and put them in prefix.
Thanks for advance!

 
#2
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Aug 5, 2016
Company: 1C-Poland

Hello Jānis,
the easiest way to extract the part of the date is to use the platform's method Format like this

Code
Prefix = Format(YourVariableContainingTheDate,"DF=ddMM")

How to apply the extracted prefix to the number? - it depends on the solution you use.
In the abstract solution there should be document's event
Code
Procedure OnSetNewNumber(StandardProcessing, Prefix)

where you can pass your prefix

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 2, 2019
Company:

Thanks, but how do I set date to variable, if date is selected by user?

 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 10, 2017
Company: Rufinor

Dear Jānis,

It depends on where the user is selecting the date. But usually you just add the event handler to the date control on the form and assign the selected date to your variable like this

YourVariableContainingTheDate = YourSelectedDate;

 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 2, 2019
Company:

Thanks for big help Pawlo and Alex : )

 
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.