Hello scripts specialists !
In a mairlist script, I try to do a search based on standard metadata to find a set of Playlist Item.
Here is my current code, but execution goes to an “access violation”.
var
resultSearch: IPlaylist;
mySearch: TDatabaseSearchOptions;
handler: IDatabaseSearchHandler;
begin
mySearch.Term := '''PODCAST-CLOSER''=''yes''';
mySearch.Fields := [dbsfStandardAttributes];
mySearch.Limit := 2;
handler := Database(0).SearchItems(mySearch, resultSearch);
//SystemLog(Database(0).GetStandardAttributes.GetNames.GetItem(0));
//SystemLog('taille: ' + IntToStr(resultSearch.GetCount));
end.
I think this is the “Term” property which is wrong but I don’t know the correct syntax.
(My use case : find all items where the metadata named PODCAST-CLOSER equals to the value ‘yes’ - it’s a checkbox in mairlist)
Any idea ?
If ever I didn’t get an answer, in workaround, as I found how to get all the items from a folder in scripts, I will code myself a loop on all these items to find the correct ones (getting their metadata one by one), but I think there is a better way to achieve it. So is my question.
Note : No need to tell me that I can define a filter in my clock template, on a “random item from folder” item, because I already know that. But I do have to search in database within a script…
Regards
Sylvain