Need help using fast report

If you need help on how to use the program
Post Reply
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Need help using fast report

Post by daws0n »

Hi everyone,
I have been modding AMC to use it as a basic stock cataloguing system. So far it is working as planned, and I am working on a order print out form using freereport.

I have designed the basic layout ok, but I am having problems using the SUM commands. They are documented a little in the help file, but it's a bit too complex for me.... Basically, all I want to do is multiply the [length] field by the [resolution] field.

Could anyone help me out please?
Thanks,
Dawson
antp
Site Admin
Posts: 9720
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

It should be possible using the "script" option in the text fields of the report.

There is a basic example in the help file of AMC:
In the window used for editing text items and pictures, a "Script" option can be checked. Then, the bottom part of the window allows to enter a script. The scripts used here are not related to those used by Ant Movie Catalog, except that the language used is also based on Pascal. Here are few examples:

If you want an image to appear only for Action movies, put the following code in the "Script" part of image's memo:

Code: Select all

begin
  Visible := [Category] = 'Action';
end;
If you want to put the year between parenthesis after the title only if the year is specified for the movie (to prevent empty parenthesis), put the following code in the "Script" part of a text item:

Code: Select all

begin
if ([Year] <> '') then
  tmp1 := [OriginalTitle] + ' (' + [Year] + ')'
else
  tmp1 := [OriginalTitle]
end;
Then place in the text area the code [tmp1] to use the script result as a new variable.
If you do something like:

tmp1 := IntToStr(StrToInt([lenght]) * StrToInt([resolution]));

maybe it would work (or maybe not :D I do not know that thing very well as it was not made by me)
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

It did not work at first, but I have taken the IntToStr and StrToInt conversion commands out and simplified it down to -

Totalcost := ([Length]) * ([Resolution]));

and it works :D Thanks for the help antp, much appreciated! I am considering trying a bit of coding myself, what do you suggest for a good begginer/starting point?
antp
Site Admin
Posts: 9720
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I did not know that it would work to mix numbers and text like that ;)

You mean coding what? Scripts of reports, script for importing info, or the code of the program itself?
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

AMC is coming up with this message whenever I try to run the report now :angry:

"Could not convert variant of type (string) into type (Double)"

Script has been unchanged... Any ideas?
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

Sussed it!

If the QTY ordered field [Length] is empty, it caused the error. I have worked around it with the following code -

if ([Length] <> '') then
Totalcost := [Length] * [Resolution]
else
Totalcost := '-'

With regards to the IntToStr and StrToInt commands, should I try to implement them in? I am only use numerical characters in the fields, so will it matter?
Thanks again!
Dawson
antp
Site Admin
Posts: 9720
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

daws0n wrote:should I try to implement them in?
If it works without them, no ;)
Post Reply