Page 1 of 1

SolutionModel - Get a list of Medias

PostPosted: Mon Jun 29, 2009 9:45 pm
by LOGIsoft
Hi,

It would be nice to be able to obtain a list of medias for a solution via the SolutionModel, just like we do for the Methods and Variables (both form and Global) - maybe even including the medias in the modules used? Pretty please... :)

Thanks,

Ben

Re: SolutionModel - Get a list of Medias

PostPosted: Tue Jun 30, 2009 9:45 am
by mboegem
Although you must be carefull with this: you could use the repository database to extract this data.

For medianames this would be the query:
Code: Select all
SELECT DISTINCT property_value FROM servoy_element_properties WHERE content_id = 276

Re: SolutionModel - Get a list of Medias

PostPosted: Tue Jun 30, 2009 9:51 am
by ROCLASI
Of course that would return ALL media from ALL solutions in the repository. Not only the ones from your loaded solution and it's modules.
But if that is what you want then that would work I guess.

Re: SolutionModel - Get a list of Medias

PostPosted: Tue Jun 30, 2009 12:27 pm
by LOGIsoft
Thanks Marc and Robert - I guess I could specify the name/ID of my solution and modules in the SQL query - does anybody know the correct syntax for this?

Actually, it would be nice to have an (exhaustive) list of properties (such as all possible values for content_id and what they mean, ie. 276 = MEDIA) we can get back from the repository using SQL queries... :idea:

Thanks again,

Ben

Re: SolutionModel - Get a list of Medias

PostPosted: Tue Jun 30, 2009 9:16 pm
by mboegem
Hi Ben,

looked a bit further into this as it is not a big mysterie to get down to what you want from the repository...

Code: Select all
SELECT ep.property_value FROM servoy_element_properties ep, servoy_elements e, servoy_root_elements re where re.name = ? and ep.content_id = 276 and ep.element_id = e.element_id and e.root_element_id = re.root_element_id


you need to pass an argument into the query which is the name of the solution...

Re: SolutionModel - Get a list of Medias

PostPosted: Wed Jul 01, 2009 12:24 pm
by LOGIsoft
Thanks for that code snippet, Marc - much obliged. :)

Still would like to know where we can find a list of content_id numbers and what they mean, though... :(

Re: SolutionModel - Get a list of Medias

PostPosted: Wed Jul 01, 2009 12:47 pm
by pbakker
Querying the repository database is not recommended at all. For one, the structure of the repository database might change between versions of Servoy.

Better to request the feature to get a list of all media's.

Paul

Re: SolutionModel - Get a list of Medias

PostPosted: Wed Jul 01, 2009 2:56 pm
by mboegem
mboegem wrote:Although you must be carefull with this


That's why I started off with the above at the first place.

Reading the data will not harm the repository, but what Paul stated is right (of course, he's a Servoyian :D )

We use it to have easy access to the correct spelling of our media, when entering the medianame in the applications metadata.
As this is for internal use, customers won't even notice when this piece of code won't work as a result of future repository changes...

Anyway, thnkx for your completion Paul!