Using date functions?

I cannot get it to work, the help file is not really a help.

I want to user anyhow the date functions (dateutils) from a script to calculate some dates, but I am not able to do so.

for example, I want to use the EncodeDate and YearsBetween in a script, how to do that???

Figured it out, adding ap_dateutils to the pascal codse and DateUtils to the script.

Seems to be case sensitive. Adding dateutil top the script result in a not found exception.

It's not case sensitive. Did you add "dateutils" or "dateutil" (which would not work)?

Hm thanks. It must have been misspelled. Now it works.

But I run into another issue. I added ap_strutils to the uses clause in the delphi program, and strutils to the uses clause of the script, and it cant find the definition of rfReplaceAll for stringreplace.

Unfortunately, I cannot edit or delete a message once posted :(

I added ap_sysutils, ap_strutils etc., and it still cannot resilve rfreplaceall, but thats ok, I definied it.

What is wrong with this?

Script:


uses
	SysUtils;


const
	rfReplaceAll = 0;
	
procedure GetData(code);
var
	s;
begin
	s:=stringreplace(code,'{','',[rfReplaceAll]);
end; 


Delphi:


scripter:=TatPascalScripter.Create(nil);

scripter.SourceCode.LoadFromFile('f:\test.txt');
scripter.ExecuteSubroutine('GetData',s);


I get an exception:

[rfReplaceAll] for scripter is an array constructor.

To create a set, you use this:

SetOf([rfReplaceAll])

so:

s:=stringreplace(code,'{','',SetOf([rfReplaceAll]));

Thank you very much, that works. Is there any help file listing such changes?

That function is listed at the end of this topic:

http://www.tmssoftware.biz/business/scripter/doc/web/index.html?thetatsystemlibrarylibrary.htm