Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Manually: generating data based on other data

Forum

Search UsersRules
Manually: generating data based on other data
#1
Just came
Points:: 0
Joined:: Jul 31, 2014

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!

Profile
#2
Active user
Points:: 0
Joined:: Nov 3, 2011

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.

Profile
#3
Just came
Points:: 0
Joined:: Jul 31, 2014

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?

Profile
#4
Active user
Points:: 0
Joined:: Nov 3, 2011

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.

Profile
#5
Just came
Points:: 0
Joined:: Jul 31, 2014

Second option works like a charm. Many thanks!

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.