How to edit parameters in Document Templates?

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Aug 19, 2019
Company: Asfarma International Pharma Marketing

Hello,

I need to update an existing Document Template. For the sake of simplicity, I will show my issue on basic simple Document Template as shown below. Document has only two attributes "Number" and "Date". (Please see below)



When I run this report, I need to add some string prefix to "Number" parameter in a way that some string and current year should be added (eg: "PREFIX" + YEAR() + <Number>)



Any support appreceated.

Regards
Savas

Edited: Savas Karaduman - Sep 27, 2019 10:07 AM
 
#2
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Sep 7, 2019
Company:

Use the 'Template' FillType.

Code to fill the template parameters looks like this:

Code
Section.Parameters.Year = Year(CurrentDate());
Section.Parameters.Number = "66613";


My Webpage

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

 
#4
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Aug 19, 2019
Company: Asfarma International Pharma Marketing

Dear Leo Sadovsky,

Thank you for response. The link you sent is somehow broken. Can you please send me in different way, may be via email "savas.erzin@gmail.com"

As you advised in your reply, which module are you writing these codes and what "Section" is stand for there? My words are very demanding but I cannot get any clue in my documentations so far. Any further help appreceated.

Regards
Savas

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

Quote
link you sent is somehow broken
The link is to the image I've posted a second later at Sep 28, 2019 04:32 AM. I've just missused the bottons - used 'Hyperlink' instead of 'Image attachment'

Quote
which module are you writing
that code should be placed to the method, where you fill your spreadsheet document

Quote
what "Section" is
is the section of your template, which you create with the SpreadsheetDocument::GetArea() method

This example creates the spreadsheet document, gets the template similar to the screenshot above, fills the section parameters and then puts the section into the spreadsheet document:
Code
SpDoc = New SpreadsheetDocument;

Template = GetTemplate("Template1");

Section = Template.GetArea("Section"); 
Section.Parameters.Year = Year(CurrentDate());
Section.Parameters.Number = "66613";

SpDoc.Put(Secion);

 
#6
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Aug 19, 2019
Company: Asfarma International Pharma Marketing

Dear Leo Sadovsky,

Thank you for your response again but I cannot go to solution yet.

Let me ask my question this way.

This is my Spreadsheet template on PersonelDoc. As you can see, I have created a "Test" parameter where Fill Type is "parameter".



I click Object Module on Document properties window as shown below.



Then it takes me to code window where Print template is generated. This code is generated automatically by system. (please see below)



Fr om this point, I think I can go to somewhere where I can use "Test" parameter to assign "PREFIX-2019-Number".

1) As we can see in generated code, SQL statement seems very promising where I can add traditionally any number of column I wish. Lets say, wouldnt be perfect if I would add such "Test" field then I can capture in code as parameter. But it seems that this is not working in 1C approach

Code
   "SEL ECT
   |   PersonelDoc.Date,
   |   PersonelDoc.Number,
   |   N'PREFIX-'  + CONVERT(nVarChar(4),YEAR(GETDATE())) + N'-' + PersonelDoc.Number AS Test
   |FROM


2) As a second option, I can add a code as shown below wh ere I can assing "Number" into "Test" parameter but it is also not working because "Test" parameter is Empty String in report.

Code
   Header.Parameters.Test = "PREFIX" + TakeCurrentYearSomeHow().ToString() +  Header.Parameters.Number;


Can you please advise how can I assing value into "Test" parameter fr om "Number"?

Any support appreceated

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



There is an example of the correc use of the 'template' FillType

https://1drv.ms/u/s!AlzlxyjYDx-juQtPSAPcDCR8gkoN

 
#8
People who like this:1Yes/0No
Just came
Rating: 1
Joined: Aug 19, 2019
Company: Asfarma International Pharma Marketing

Dear Leo Sadovsky, ,

I owe you a pint, really good help. Thank you.

 
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.