I want to add genre "saw" to all films containing "saw" in the translated title. Is it possible?
I know they are only 6, but I would like to know how to do similar operations when needed
Thanks
Adding genres on certain films
here it is:
Here I use "Pos" function to see where 'saw' appears in the text, and if it appears (position > 0) I set the other field.
Note that I use AnsiLowerCase on the title text to convert it to the same case as the searched text because by default if you search 'saw' in the title 'Saw IV' for example, it won't find it. The search is case-sensitive.
Code: Select all
program NewScript;
var s: string;
begin
s := GetField(fieldTranslatedTitle);
if Pos('saw', AnsiLowerCase(s)) > 0 then
SetField(fieldCategory, 'saw');
end.
Note that I use AnsiLowerCase on the title text to convert it to the same case as the searched text because by default if you search 'saw' in the title 'Saw IV' for example, it won't find it. The search is case-sensitive.
-
- Posts: 863
- Joined: 2006-08-31 23:58:18
Yesz3us wrote:But that script will replace the whole cattegory field for "saw" Wont it?
In that casez3us wrote:I want to add, so if the original cattegory field is "Terror", it would be changed to "Terror, saw"
Code: Select all
program NewScript;
var s: string;
begin
s := GetField(fieldTranslatedTitle);
if Pos('saw', AnsiLowerCase(s)) > 0 then
SetField(fieldCategory, GetField(fieldCategory)+', Saw');
end.