Page 1 of 1

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

Posted: Mon May 02, 2016 10:52 am
by MarkD
How should I structure server modules used in VLF-ONE applications?
http://docs.lansa.com/140/en/lansa048/i ... 8_6710.htm

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

Posted: Thu May 26, 2016 2:49 pm
by Nick Eleini
Hi Mark
Is the link supplied correct?
Regards
Nick

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

Posted: Thu May 26, 2016 3:11 pm
by MarkD
It used to work. I am investigating what has happened and will get back to you.

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

Posted: Thu May 26, 2016 3:18 pm
by MarkD
Attached is the guide section that the URL should show.
ServerModules.zip
(237.19 KiB) Downloaded 193 times

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

Posted: Thu May 26, 2016 3:57 pm
by MarkD
The preceding URL should also work again now.
Thanks for pointing out the problem.

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

Posted: Mon Jul 18, 2016 4:24 pm
by davidbalansa
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

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

Posted: Mon Jul 18, 2016 5:03 pm
by MarkD
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