About your first question, did you check out the semicolon-function (;) ?
(; Entity theproperty) returns the property.
to show it, you could do (show (; Entity theproperty))
As ABU mentioned (getl) you can fetch all properties of a symbol.
some untested code snippet which fetches all properties and applies (show)
(class +A +Entity)
(dm show> ()
(for Prop (getl This)
(show Prop) ) )
or shorter as:
(dm show> ()
(mapcar show (getl This)) )
With this you can make a customized reimplementation of show, maybe
something like this (untested code, just to give you some ideas):
(dm show> ()
(let (Indent 0
(recur (Indent Obj)
(println (type Obj)) # print list of classes of This
(for Prop (getl This) # iterate over all properties of This
(align Indent " ")
(prinl (name Prop)) # print the name of the property
(recurse Indent Prop) ) ) ) )
This is only working in REPL of course (if its working, not tested).
For the html gui you will need another way, like replacing all (prinl)
statements with html generating code (look at lib/xhtml.l)
> Hi David,
>> If I have an +Entity with a +Joint to another +Entity and (show ...) it
>> get an external symbol rather than the data connected to it. How can I
>> all of the data connected to this object? So far the best I've come up
>> is to (dm show> ...) and use (show (: theproperty)) but I want to know
>> there's a more idiomatic way.
> If I understand you correctly, you are looking for a generic and
> reflective way to show all data, without having to write entity-specific
> methods, right?
> The 'edit' function is remotely doing that, in that it shows the
> class(es) of the object(s) in a relation (and also decodes calendar
> dates). It doesn't show the individual properties of those objects,
> though, but recurses if you click on them with 'K'. In general, I would
> use 'edit' to browse graphs of database objects.
> Otherwise, you could write a custom version of 'show' which displays all
> properties of the object using 'getl'. But I do not believe it will be
> visually appealing.
>> Also how would I connect a (gui ...) component to such an object which
>> show all of the data of the object rather than external symbols ponting
> As gui components are typed, you would have to resort to a dumb text
> field or textarea to show things completely generically. How about using
> the gui 'repl' function (which opens an interactive REPL in the browser,
> be careful about security issues!!) and then your 'show' from above? ;)
> âªâ« Alex
> UNSUBSCRIBE: mailto:email@example.com?subject=Unsubscribe