Hello,
What DA version do you use?
We don’t recommend to use pascal script in business rules script. It’s obsolete and isn’t used in new DA versions.
This article will be useful for you: http://wiki.remobjects.com/wiki/Business_Rules_Scripting
Im using latest version and we dont stop using this if not be forced… Is a waye better than the javascript support. Why you dont recomend using it? The only reason can be because you will remove support for this. I really hope you dont think on do that.
Pascal script in schema modeler is a lot friendly to code. Examples:
It shows ALL THE FIELDS on the editor windows.
It shows a LOT MORE CLEAR events descriptions (like afterpost or beforepost)
And the better: is pascal.
Why can somebody think on removing something is working perfect? Wich are the advantages to Delphi users to migrate to JS on that scripts? I see zero advantages.
Read follow on wiki:
The Spring 2011 release adds JavaScript-based Business Rules Scripting to Data Abstract for Delphi (Win32 only), replacing the old Pascal Script based scripting support (which is still available, but not cross-platform and now considered legacy).
I also think it works very well for Delphi Business Rules scripting, but hey, the big boss changes the rules from time to time …
Hello,
You can use TDAPSScriptingProvider only on the client side.
On the server side you can use TDASpiderMonkeyScriptProvider, TDAEcmaScriptProvider, TDAActiveScriptProvider.
Pascal script is obsolete and haven’t been supported yet.
The wiki say:
“If you use Delphi, you simply need to place the TDASpiderMonkeyScriptProvider on the Data Abstract service and assign the ScriptProvider property on the service to the new component (for server scripting), or place the same class next to the data table(s) (TDAMemDataTable class) and assign the ScriptingProvider property on that component to the TDASpiderMonkeyScriptProvider (for client scripting).”
That is not that i need.
Im dont want to call a script when theres a request to a datatable.
I have code in the server, running not for a service request, and that code usa IDADatasets.
I need script by runned on that requests, not related to cliente calls, theres no cliente concept here, just pure server code.
See that sample server code, executed for server conditions, no client calls.
var
ActuaFacturas : IDASqlCommand;
begin
ActuaFacturas := ServerDataModule.Schema.NewCommand(lConexionFacturar,
‘Insert_wahtever’,
[‘IDFACTURA’,‘CODIGO’], [FacturaID, Codigo]);
Theres any way tis command use a rule script on the schema?
Hello,
You can also work with Business Rules Scripting in commands if you use TRORemoteCommand component to call them.
If you want to use a rule script on the schema please do the following:
procedure TDataService.RunCommand;
var
cmd:IDASQLCommand;
aParameters: DataParameterArray;
aParameterNames: array of String;
aParameterValues: array of variant;
aAllowed:Boolean;
aCommandName:String;
begin
aAllowed := False;
aCommandName := 'NewCommand';
ServiceSchema;//call SetupScriptProvider
ScriptProvider.ValidateCommandAccess(aCommandName,aParameterNames, aParameterValues, aAllowed);
if not aAllowed then raise EDADatasetNotAccessible.CreateFmt(err_CommandNotAccessible, [aCommandName]);
aParameters:= DataParameterArray.Create;
try
cmd := Schema.NewCommand(Connection, aCommandName);
ScriptProvider.BeforeExecuteCommand(cmd.SQL, cmd.Name, aParameters);
cmd.Execute;
ScriptProvider.AfterExecuteCommand(cmd.SQL, cmd.Name, aParameters, 0);
finally
FreeAndNil(aParameters);
end;
end;