Page 1 of 1

SetField(fieldDate, '') doesn't work

Posted: 2008-11-03 17:54:53
by green
Because I imported a list of movie titles, they all appear at the same date. I'd like to set the date field to empty (the same as checking the date field on the main database window).

So I wrote a small script:

program ClearDate;
const
dconst = '';

begin
if CanSetField(fieldDate) then
begin
SetField(fieldDate, dconst);
end;
end.

When I run the script on a single entry, I see that it is changed by the Window that shows changes and I click on "Save". However, the database isn't updated.

When I go to the Editor and click "Run", it changes /all/ entries in the database and clears it.

What I'd like to do is be able to select a range of entries and run my script to clear about 90% of the date fields. At the moment though, it's only all or nothing.

Any ideas?

Posted: 2008-11-03 21:06:37
by antp
Be sure that the "allow to clear fields" option in script window is enabled.

You also have options to specify if the script should apply to selected movies or to all movies.

Posted: 2008-11-04 17:42:45
by green
That was the problem. Didn't notice that field.

Switching between Scripts and Editor must reset those check boxes somehow.

Posted: 2008-11-04 19:40:09
by antp
I think it should remember the options separately for each of the two windows ("scripting") and ("get info from script"). Else there may be a bug...
But anyway it should not reset the options when switching from a page to another, else again there is a bug.