SetField(fieldDate, '') doesn't work

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
green
Posts: 8
Joined: 2008-04-28 13:05:27

SetField(fieldDate, '') doesn't work

Post 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?
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post 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.
green
Posts: 8
Joined: 2008-04-28 13:05:27

Post by green »

That was the problem. Didn't notice that field.

Switching between Scripts and Editor must reset those check boxes somehow.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post 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.
Post Reply