Manually: generating data based on other data

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 31, 2014
Company:

Hello,

I really like the "base on" property to copy the data into a new
object, but I would like to customize the presentation name and display
an icon in the form command bar. I don't think it is possible this way.

How can I achieve the same functionality by my own code? (without saving the new object before showing the input form)

Thx for your help!

 
#2
People who like this:0Yes/0No
Active user
Rating: 7
Joined: Nov 3, 2011
Company: 1C Company

Oliver,

of course you can change the presentation. Add the following procedures to the object manager module:

  • PresentationFieldsGetProcessing (for getting the fields that form the presentation)
  • PresentationGetProcessing (for generating the presentation based on these fields)

Example:

Code
Procedure PresentationFieldsGetProcessing(Fields, StandardProcessing)
 
 // Use custom fields for building presentation.
 StandardProcessing = False;
 
 // Add presentation field names.
 Fields.Add("Number");
 Fields.Add("Date");
 
EndProcedure

Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing)
 
 // Define custom document name presentation.
 Data.Insert("Name", "PO");
 
 // Generate standard presentation.
 Presentation = GetDocumentPresentation(Data, StandardProcessing);
 
EndProcedure

Function GetDocumentPresentation(Data, StdProcessing) Export
 
 // Create custom document description.
 StdProcessing = False;
 
 // Define document name template.
 Presentation = "{Name} #{Number} {Date}";
 
 // Fill the template by document data.
 For Each Item In Data Do
  Presentation = StrReplace(Presentation, "{" + Item.Key + "}",
   GetDocumentDataPresentation(Item.Key, Item.Value));
 EndDo;
 
 // Return filled presentation.
 Return Presentation;
 
EndFunction


As for command bar icons, what exactly do you mean? Just pictures or buttons that do something? Adding "just pictures" is not supported.

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 31, 2014
Company:

Hello Yulia,

Thank you for your fast answer. Unfortunately, I did not hit the subscribe to this topic button.



My goal is to replace the standard "Document: generate" command with a custom command. So I can use a custom name and icon for my generate command.

The way to do that is described here, indicated in Point 5:
https://yellow-erp.com/2013/11/managed-application-correct-software-form-open/


My Code (of the document base):

&AtClient
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)

P = New Structure;
P.Insert("FillingData", CommandParameter);

OpenForm("Document.OutgoingInvoice.ObjectForm", P);

EndProcedure

If I debug the "Filling" procedure of the OutgoingInvoice object module, the parameter "FillingData" is undefined.

How do I get it to work?

Edited: Oliver Lux - Nov 20, 2017 09:39 AM
 
#4
People who like this:0Yes/0No
Active user
Rating: 7
Joined: Nov 3, 2011
Company: 1C Company

Oliver Lux,

please set another parameter instead of FillingData. Examples:

Code
P.Insert("FillingValues", New Structure("Order", CommandParameter));


Code
P.Insert("Basis", CommandParameter);


I think the latter option better fits your scenario.

 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 31, 2014
Company:

Second option works like a charm. Many thanks!

Edited: Oliver Lux - Nov 22, 2017 06:10 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.