[REL] 3 Column listing with Rating (for print)

If you made a template for printing or HTML export, you can offer it to the others here. You can also ask here for help about these templates
Post Reply
fruey
Posts: 5
Joined: 2006-05-17 08:08:27
Contact:

[REL] 3 Column listing with Rating (for print)

Post by fruey »

Hello,

I'm designing a 3 column template for printing based roughly on zweckform but now looking quite different.

I've got it almost perfect, but I'd like to display the rating. In my DB I always use the IMDb rating, which is a fraction out of 10. I have no problem to display the rating if it's available, but I'd like to show stars (at least *** if not an image).

The problem is that Rating is not an integer.

So, in the FreeReport scripting language how can I do it? I have code a little bit like this:

Code: Select all

begin
if ([Rating] > 7.9) then
  tmp1 := '*****'
else if ([Rating] > 6.6) then
  tmp1 := '****'
else if ([Rating] > 5.3) then
  tmp1 := '***'
else
  tmp1 := '**'
end;
This causes errors, because Rating isn't seen as a number (float) by the script. Can I acheive this?

-Fruey
Last edited by fruey on 2006-05-22 19:15:10, edited 1 time in total.
fruey
Posts: 5
Joined: 2006-05-17 08:08:27
Contact:

Getting somewhere

Post by fruey »

I am getting somewhere, but the scripting language examples given in FreeReport don't even work. So it's a bit difficult!

Here's the code that works, I'd like to be able to set a stronger colour for those exceptional movies with a rating above 9, but this is it so far:

Code: Select all

begin
if ([Rating] > '8') then
  tmp1 := '*****'
else if ([Rating] > '7') then
  tmp1 := '****'
else if ([Rating] > '6') then
  tmp1 := '***'
else if ([Rating] > '5') then
  tmp1 := '**'
else
  tmp1 := '*'
end;
-Fruey
fruey
Posts: 5
Joined: 2006-05-17 08:08:27
Contact:

Working!

Post by fruey »

Yes! :D

Basically, you have to watch your semi-colons. I'm not familiar with this syntax but I just worked it out. My report now detects rating and assigns:

***** Rated above 9 (exceptional movie)
***** >8
**** >7
*** >6
** >5
* everything else.

This is loosely accurate as a guide for films, based on an IMDb rating.

Code: Select all

begin
  if ([Rating] > '9') then
    begin
     tmp1 := '*****';
     FontColor := clRed;
     FontStyle := 2;
    end
  else
     FontColor := clBlack;
  if ([Rating] > '8') then
    tmp1 := '*****'
  else if ([Rating] > '7') then
    tmp1 := '****'
  else if ([Rating] > '6') then
    tmp1 := '***'
  else if ([Rating] > '5') then
    tmp1 := '**'
  else if ([Rating] < '5') then
    tmp1 := '*';
  if ([Rating] = '') then
    tmp1 := '';
end;
Just let me know if anyone wants my listing code; it looks like this

Image

-Fruey
smith
Posts: 2
Joined: 2006-05-21 19:04:08

Post by smith »

Just let me know if anyone wants my listing code; it looks like this
I want this code, please. Thank you.
fruey
Posts: 5
Joined: 2006-05-17 08:08:27
Contact:

[REL] 3 Column listing with Rating (for print)

Post by fruey »

Hi Smith,

Here's a link to the 3 column listing template. Just download and put it in the Templates folder.

Regards

-Fruey
smith
Posts: 2
Joined: 2006-05-21 19:04:08

Post by smith »

Thank you.

I have 2 questions:
1. Why is "[TranslatedTitle]" in some parts of the template, in the scripting window?
2. The "*" character is not displayed with the Wingdings font used to format, but with the ordinar "*" character. Not a big problem, but if I want to modify something is not working.
fruey
Posts: 5
Joined: 2006-05-17 08:08:27
Contact:

Post by fruey »

smith wrote:Thank you.

I have 2 questions:
1. Why is "[TranslatedTitle]" in some parts of the template, in the scripting window?
2. The "*" character is not displayed with the Wingdings font used to format, but with the ordinar "*" character. Not a big problem, but if I want to modify something is not working.
I'm not in front of the machine I have ANTP installed on, but I'll try to respond

1. I use [FormattedTitle] only, if my memory serves me, in this report. That way you can set it to display exactly as you wish. What is displayed in [FormattedTitle] can be set in the settings of Ant Movie Catalog. I won't be able to check until tonight, but I don't think [TranslatedTitle] is used anywhere.

Bear in mind that [FormattedTitle] is, by default, a combination of OriginalTitle and Translated Title. As you can see in my screenshot, my FormattedTitle puts "the" at the end of film titles, so Shura Yukihisme (Princess Blade, The) is the formatted title, from the setting [OriginalTitle] ([TranslatedTitle]).

2. I use a regular * because I didn't look for a star in the Wingdings font. So it will be compatible with any font you choose. I use only Arial and Book Antiqua which are 2 fonts which are installed on more or less all Windows PCs.

Talking of Wingdings you got me thinking. You can of course choose to use Wingdings and you'll have to replace the stars in the code I talk about at the top of this thread. I think the good stars in Wingdings are higher up in the ASCII table and not regular characters... like this one. Maybe I should change it, might look a lot nicer...

The code would have lines that look like this

Code: Select all

tmp1 := '«««««';


-Fruey
Post Reply