Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > How to call common module code &AtClient?

Forum

Search UsersRules
How to call common module code &AtClient?
#1
Active user
Points:: 0
Joined:: Feb 28, 2012

Hello,

We are having trouble puting our &AtClient code inside our managed forms to a common module. It seems that in a managed form if you have a procedure &Atclient the only procedures that are visible are local procedures of that form (&AtClient or &AtServer).If i create a global common module (and tick the client on the properties)  the procedures i define there are not accesible by a managed form. Is this by design or we are missing something? .Because of this we have a lot of code duplication in our forms.

Profile
#2
Guest
Points::
Joined::

Hello, Constantinos Anastasiou.

The common module can be accessible for client or not depending on the settings of the module. If you want to call a procedure of a server common module from the client (&AtClient), that server method should have Server call option enabled. Otherwise you need to call that procedure from the server (&AtServer) procedure.

Profile
#3
Just came
Points:: 0
Joined:: Jan 22, 2015

Maybe You forgot add key word Export? Like:

Code
Procedure CalculateTotal (TabularSectionRow) Export

The Export keyword in the procedure title indicates that the procedure can be accessed from other applied solution modules

Profile
#4
Active user
Points:: 0
Joined:: Feb 28, 2012

As i mentioned on my initial post with &AtServer modules its fine. the problem is with code &AtClient whicj i need to put in a common module.

For example lets say i have this code in a command inside a managed form:

Code
&AtClient 
Procedure ScanOnChange(Item) 
  qForm = GetForm("CommonForm.InputQuantityForm");
  searchQuantity = qForm.DoModal();
EndPRocedure.

How can i put the code in red in a common module and call it from my managed form?

Profile
#5
Just came
Points:: 0
Joined:: Jan 22, 2015

So You want connect form's element event with common module code directrly? You can't do this. You need both code in form and in common module:

Code
&AtClient
Procedure ScanOnChange(Item) 
    searchQuantity = YourCommonModule.SearchQuantity();
EndProcedure

And put you red code in function SearchQuantity in common module

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.