If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

This forum allows developers to post programming tips and coding techniques that may be useful to other Visual LANSA developers. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by MarkD » Mon May 02, 2016 10:52 am

How should I structure server modules used in VLF-ONE applications?
http://docs.lansa.com/140/en/lansa048/i ... 8_6710.htm

Nick Eleini
Posts: 1
Joined: Thu May 26, 2016 2:46 pm

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by Nick Eleini » Thu May 26, 2016 2:49 pm

Hi Mark
Is the link supplied correct?
Regards
Nick

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by MarkD » Thu May 26, 2016 3:11 pm

It used to work. I am investigating what has happened and will get back to you.

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by MarkD » Thu May 26, 2016 3:18 pm

Attached is the guide section that the URL should show.
ServerModules.zip
(237.19 KiB) Downloaded 190 times

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by MarkD » Thu May 26, 2016 3:57 pm

The preceding URL should also work again now.
Thanks for pointing out the problem.

davidbalansa
Posts: 47
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by davidbalansa » Mon Jul 18, 2016 4:24 pm

Hi Mark,

I was investigating the structuring of VLF-ONE Server Modules on the link provided. I like the way it is structured. I was interested to see the use of the scope(*application) in Server Modules:

Define_Com Class(#DF_T53SSO) Name(#MyServerSystem) Scope(*APPLICATION)

On the client side this would create a single application instance of the #MyServerSystem component which other client side components in the application could reference. This component would remain in memory so a value could be set by one component and retrieved by another.

I didn't think that the server side provided this capability. I have a need to use the logged in user in a number of Server Modules. So I tried my luck. I created a server module / routine and called it in the IIP to set the logged in user in my version of the #MyServerSystem. Then I created a second server module with the same define_com statement:

Define_Com Class(#DF_T53SSO) Name(#MyServerSystem) Scope(*APPLICATION)

I wrote a server routine to return the logged in user from #MyServerSystem component (To prove if the #MyServerSystem is persistent and I could retrieve the logged in user saved previously. )

What I found was I could not retrieve the values I set, and it always returned the value I set in the create instance event of the #MyServerSystem component. Leading me to believe the #MyServerSystem component was created each time I accessed a server module.

My Questions are:
1. Can I store persistent data in a shared component on the server that my server modules can access?
2. If not, what advantage is gained by using scope(*application) in server?

Regards,
David

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: If you are thinking about structuring VLF-ONE server modules this is probably worth reviewing ......

Post by MarkD » Mon Jul 18, 2016 5:03 pm

VL-Web server modules are normally stateless, so everything disappears when one ends.

One advantage of using a scope(*Application) object in server side code is that it acts as a natural place to put all your common / shared methods and values (eg: current user number).

By using Scope(*Application) VL only needs to one instance per server interaction. If you leave the Scope(*Application) off, and used it in three other VL components (say) then you could get three instances created and then three being destroyed.

VL-Web server modules can persist the state of fields and lists between interactions within a session by using the PERSIST command - http://docs.lansa.com/14/en/LANSA015/Co ... ersist.htm

Post Reply