Scripting question: Retrieve an item in database with lookupByFilename method?

Hello everybody,

For scripting experts (maybe Torben), do you know if it’s possible retrieving an item in database, with script and the lookupByFilename method, using a running mairlist with a “http server” database connexion ? Script is launch by a screen object (button).

If I try the code below with a mairlist instance using a “local” database connexion, it works. But if I use it on a mairlist instance with an HTTP server database connexion, it failed (with a null pointer exception on the itemOpener variable).

Maybe it’s not valid to use the IDBAccess object, but how ?

var
	dbAccess: IDBAccess;
	itemOpener, itemSweeper, itemCloser: IPlaylistItem
begin
	// Seach in database
	dbAccess := IDBConnection(Database(0)).CreateOrReuseAccess(true);
	
	itemOpener := dbAccess.LookupByFilename(HOOK_OPENER);
	openerDuration := TimeValueToSeconds(itemOpener.GetEffectivePlaybackDuration);

end;

If someone know, help would be very appreciated :slight_smile:

Regards,

Sylvain

I think it would be helpful to adress @Torben directly so he will not miss and can answer when he has some time… :slight_smile:

You right. I never think I can (I don’t want to disturb him).
Strange that I can’t edit my message to tag it (and also change the topic title that I didn’t end to write… so sorry).

That’s a rule in this forum to prevent people from editing threads after a long period of time and change the context of their messages :wink:

(I changed the topic, is this okay for you?)

Ok, I didn’t see that with my previous topics.
Thank you for the change, it’s perfect !

1 Like