Hi all first, this is my debut in this forum.
Let's see my problem: it happens when I try to sort my database by MediaLabel variable.
here's the screenshot:
The numbers are not ordered as you can see: 10 must be after 9 and not just after 1, the same for 100...it should be after 99 but it's just after 10.
If I try to export the database I obtain the same type of sorting.
I need it to be 1-2-3.....9-10-11.....99-100-101.... and not 1-10-100-101...and so on.
what's wrong?
Sort->MediaLabel
Nothing's wrong
I think it is because MediaLabel is no 'integer' but some kind of 'string' variable, and then it is the normal behaviour. In MediaType field you cannot use numbers only, but all kind of letters. Sorting will start with the first letter of the word (or integer), then read the second one, third one - and so on.
You should add some leading '0' if you want to get a proper listing.
001
002
...
010
011
..
But maybe I'm wrong and there is a better solution ?
I think it is because MediaLabel is no 'integer' but some kind of 'string' variable, and then it is the normal behaviour. In MediaType field you cannot use numbers only, but all kind of letters. Sorting will start with the first letter of the word (or integer), then read the second one, third one - and so on.
You should add some leading '0' if you want to get a proper listing.
001
002
...
010
011
..
But maybe I'm wrong and there is a better solution ?
OK so here is it:
Go to tools -> scripting, or press F6.
Be sure that in "script limitations" you have checked "all" (or "selected" if you want to modify only the selected movies).
In the "editor" tab click the "new" icon and replace the script template by the one above.
The click run and it should be done
(you can reply "no" when the program asks if you want to save the script, except if you want to reuse it later)
Code: Select all
program NewScript;
var
s: string;
begin
s := GetField(fieldMedia);
if s <> '' then
begin
while Length(s) < 4 do
s := '0' + s;
SetField(fieldMedia, s);
end;
end.
Be sure that in "script limitations" you have checked "all" (or "selected" if you want to modify only the selected movies).
In the "editor" tab click the "new" icon and replace the script template by the one above.
The click run and it should be done
(you can reply "no" when the program asks if you want to save the script, except if you want to reuse it later)