VFP ExecScript() similarly to Servoy

Questions, tips and tricks and techniques for scripting in Servoy

VFP ExecScript() similarly to Servoy

Postby matthias_suck » Sat Sep 17, 2011 10:47 am

Hello forum,

In the VFP there is the instruction EXECSCRIPT () gives it in the Servoy somewhat similarly to it.

For example:
I have a Tableview and if I click an entry and the following code are implemented.

Tablefield “bcode” has the following code:
(var myWindow = application.createWindow (" Supplier" , JSWindow.MODAL_DIALOG); forms.Supplier.controller.sh ow (myWindow);)

My function
function onFocusGained (event) {
// TODO car generated method stub
Var xbcode = ""
application.output (form.Favorit_Menue.bcode)
xbcode = form.Favorit_Menue.bcode
EXECSCRIPT (xbcode) ?????
return true
}

Greeting
Matthias
matthias_suck
 
Posts: 10
Joined: Wed Mar 09, 2011 11:17 am

Re: VFP ExecScript() similarly to Servoy

Postby ROCLASI » Sat Sep 17, 2011 10:57 am

Hi Matthias,

JavaScript has the eval() function for this.
But usually it's frowned upon to use this because it's a security risk to use it since that external code that you don't have control over may do whatever.
Also it's slower since it's interpreted instead of compiled.
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: VFP ExecScript() similarly to Servoy

Postby matthias_suck » Sat Sep 17, 2011 11:06 am

Hi,

Thank you for your fast answer.
Is exactly which I searched.

Greeting
Matthias
matthias_suck
 
Posts: 10
Joined: Wed Mar 09, 2011 11:17 am

Re: VFP ExecScript() similarly to Servoy

Postby Peter de Groot » Sat Sep 17, 2011 11:34 am

This will also work,

var $script, $scriptObj;

$script = 'for(var i = 1 ; i <= 10 ; i++){application.output("Test")}';
$scriptObj = new Script($script);
var $d = $scriptObj();
Peter de Groot
 
Posts: 215
Joined: Thu Jan 10, 2008 8:38 pm
Location: Not sure...


Return to Methods

Who is online

Users browsing this forum: Bing [Bot] and 2 guests