Lazarus and TDASpiderMonkeyScriptProvider ( for the use of a new GUID )

Hi

In Lazarus i would like to use the function newGuid to Generate a new GUID.
I followed the wiki here:
http://wiki.remobjects.com/wiki/Business_Rules_Scripting_Overview
But it seems that Lazarus has no TDASpiderMonkeyScriptProvider?

I wold like to add some defaults on the Server:
Like this:

function onNewRow(row)
{
	log('Scripting: beforePost(row) script function fires.');
	row['ID'] = newGuidString();
	row['CERT_G'] = 'False';
	row['CERT_A'] = 'False';
	row['LTM_G'] =  'False';
	row['LTM_A'] =  'False';
	row['CS_S_T'] = 'False';
	row['STAT_DEL'] = 0;
	log('Scripting: Defaults added.');
}

Thanks for any Advice on this:
Manfred

have you installed DataAbstract_SpiderMonkeyScripting.lpk ?
note: it doesn’t support linux unless you manually compile SpiderMonkey 1.8.5

Found it, thank you.

Shalom
Manfred

I try to generate a GUID.
It is not quite clear to me if the Relativity Server does this on the Server Side or i have to do this in Lazarus.

I tryed this on the Server:
// Can be used to initialize a new records default values

function onNewRow(row)
{
	log('Scripting: beforePost(row) script function fires.');
	row['ID'] = newGuidString();
	row['CERT_G'] = 'False';
	row['CERT_A'] = 'False';
	row['LTM_G'] =  'False';
	row['LTM_A'] =  'False';
	row['CS_S_T'] = 'False';
	row['STAT_DEL'] = 0;
	log('Scripting: Defaults added.');
}

But it looks like the Script is not executed. And i tried also this in Lazarus:

function TDM.Base64GUID(args: array of variant): variant;
var
  NewGuid:TGuid;
  Encoder:IdCoderMIME.TIdEncoderMIME;
  Bytes: TBytes;
begin
  try
    CreateGUID(NewGuid);
    Encoder:=TIdEnCoderMIME.Create;
    Bytes:=TEncoding.ASCII.GetBytes(GuidToString(NewGuid));
    result := Encoder.EncodeBytes(Bytes);
  finally
    Encoder.Free;
  end;
end;   

Here i have the Error: Identifier not found “TEncoding”

procedure TDM_member.tbl_memberAfterInsert(DataTable: TDADataTable);
begin
       if (tbl_member_CanInsert) then
       begin
         with tbl_member do
         begin
           //FieldByName('ID').AsString:=CreateClassID;  // Generate GUID
           FieldByName('ID').AsString:=NewGuid();  // Generate GUID
           FieldByName('C_NO').AsString:=camp_no;
           FieldByName('U_NO').AsInteger:=gideon_no;
           FieldByName('CERT_G').AsString:='False';
           FieldByName('CERT_A').AsString:='False';
           FieldByName('LTM_G').AsString:='False';
           FieldByName('LTM_A').AsString:='False';
           FieldByName('CS_S_T').AsString:='False';
           FieldByName('L_UPDATE').AsDateTime := Now;
           FieldByName('STAT_DEL').AsString:=('0');
           Post;
         end;
       end;
end;   

Is there a way to do this completely on the Server?

afaik, TEncoding is Delphi class that can be missed in lazarus/fpc