[EMAIL PROTECTED] wrote:

I've been experimenting with these things (and looking at some other code,
like KitViewer), but I still haven't managed to figure out the answers:

1) Given that I have a view, how can I get what the name of that view is?
Certainly, I suppose, this question makes sense only for non-derived views,
but it does seem to make sense for them and yet I can't see how to get the
view's name from the view itself -- or how to "find" the view's name from
anything else in the database together with the view itself.  Is there a
way to do this?

The only way I have found is to hijack the getas and view functions using my metawrap metakit wrapper, see http://staffa.wi.mit.edu/people/kelley/metawrap.py. For example:

def getas(self, description):
     name = description.split("[")[0]
     view = view(vw=self._db.getas(description), st=self)
     view.name = name
     return view

def view(self, viewname):
     view = view(vw=self._db.view(viename), st=self)
     view.name = viewname
     return view

I anyone has a better way, I'm all ears :)

2) How do I get the list of properties belonging to a view in the order
that these were specified in the description defining the view?  I think
that KitViewer and kviewer do this, but I can't see how they get the
properties in this order, and when I try the same (or apparently similar)
code, the list of properties I get is not in the order of the original
description.

view.structure() -> returns the list in order of the view's properties.

view.properties() returns a dictionary so this by definition is unordered.


-------------------------------------- Gary H. Merrill Director and Principal Scientist, New Applications Data Exploration Sciences GlaxoSmithKline Inc. (919) 483-8456




_____________________________________________
Metakit mailing list - [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit




_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to