How to change dataSource of existing form using a method?

Questions, tips and tricks and techniques for scripting in Servoy

How to change dataSource of existing form using a method?

Postby Westy » Tue Apr 08, 2014 4:25 pm

How can I change an existing form's dataSource property using a method?

Dean
Servoy Developer 6.0.8 - build 1237
Westy
 
Posts: 845
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: How to change dataSource of existing form using a method

Postby ROCLASI » Tue Apr 08, 2014 11:28 pm

Hi Dean,

The datasource is not a runtime property so you can't change it on the fly. You can however change it using the SolutionModel.
This however requires the 'destruction' of the loaded form before you can change it. So the form can not be visible or in use by anything when you do this.
By the way, what is your exact use-case for this? Perhaps a 'cloned' form with a new datasource might be a better approach. This can all be done by code.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Twitter: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5342
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: How to change dataSource of existing form using a method

Postby Westy » Thu Apr 10, 2014 9:06 pm

I like your idea of using a 'clone' of the form. Thank you.

Dean
Westy
 
Posts: 845
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA


Return to Methods

Who is online

Users browsing this forum: No registered users and 1 guest