Arbitrary variable on print form

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

How to display a value of some arbitrary variable on print form?

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

Hello!

You just need to declare a variable in a section of a printing form and then in a module to assign any value to this variable before section print out

Kind regards,
Alexander

 
#3
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Hi Peter,

are you familiar with the technology of creating reports in 1C?

 
#4
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

Alex, do you mean by "section of a printing form" a Template Print form? If this is what you mean, then I tried and it didn't work. The value to such variable I assigned in Manager Module. If you mean something else - explain more clearly, please. Or give an example.

 
#5
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

Figured out. Here's how I solved this problem:

PeriodStruct = New Structure;
PeriodStruct.Insert( "Date1", Object.Date1 );  
PeriodStruct.Insert( "Date2", Object.Date2 );

HeaderArea.Parameters.Fill( PeriodStruct );


And in the header of my print form I use [Date1] and [Date2] to refer to these parameters.

 
#6
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Quote
Or give an example.

Hi Peter,

look at pls the screenshots. I think everything will be clear to you there :)

Download scr_2.png (48.38 KB)
Download scr_3.png (66.96 KB)
 
#7
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

This method works fine for displaying something in header or footer area, but it didn't work in table part of my report. I am using the latest version of the platform.

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

It works well both in header, footer and in table part. In table part you just need to do this in cycle of table part

Kind regards,
Alex

 
#9
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Quote
This method works fine for displaying something in header or footer area, but it didn't work in table part of my report. I am using the latest version of the platform.

Hey Peter,

this is very strange because it is a universal method and it should work everywhere.

Let's try to figure it out and find the bug. Could you bring either a piece of the source code, or your report in its entirety?

 
#10
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Btw, there is another way to output values to printed forms:

Download pic_1.png (33.24 KB)
 
#11
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

Here's how it looks on my screen. AmountDoc is what I want to display on my report, DtDoc and CrDoc are resources of my accumulation register.

 
#12
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Most likely, you have not set (or incorrectly set) the "AmountDoc" parameter. Could you please send me your report to abir@1c.com - I'll take a look and point out where the error is.

Download Pic_1.png (23.76 KB)
 
#13
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

What you see on the screenshot is the only reference on parameter AmountDoc in my code. How I could "not set (or incorrectly set) the 'AmountDoc' parameter"? You see the whole line of code on the screenshot. What is wrong in that line of code? SelectionDetailRecords is what you get when apply Select() to Query result.

 
#14
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

If you want me to help you, I need to see your code in full, not a screenshot.

This method of setting values in printed forms has been working for a hundred years and I wonder what you did there that it doesn't work for you :-)

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

Most probably you didn't set up properly variable AmountDoc in a spreadsheet document. Did you assign Filltype field as Parameter for variable AmountDoc in your Spreadsheet document ?

Kind regards,
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.