Page 1 of 1

automatically name category based on rating

Posted: 2009-10-12 15:04:58
by scottdw
I import the movies rating (G,PG,PG-13) from DVDEmpire but would like to be able to in a script have it automatically fill in the category field with a custom category name based on the rating.

For example if the rating is G or PG name the category field "Kids"
or if the rating is R or NC-17 name it "Adult".

Can someone give me an example of a script that I can customize to do this.

Thanks,
Scott

Posted: 2009-10-12 15:41:12
by antp
Supposing that the category field already contains the rating (else just change the field name in "getfield" line)

Code: Select all

program NewScript;
var 
  s: string;
begin
  s := GetField(fieldCategory);
  if (s = 'R') or (s = 'NC-17') then
    SetField(fieldCategory, 'Adult')
  else
  if (s = 'G') or (s = 'PG') then
    SetField(fieldCategory, 'Kids')
end.

Posted: 2009-10-13 23:29:50
by scottdw
Thanks alot.