Print Page | Close Window

Getting the details right in display

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=124
Printed Date: 27.Mar.2026 at 00:26
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Getting the details right in display
Posted By: Angelo
Subject: Getting the details right in display
Date Posted: 17.Nov.2009 at 00:49
Right now, I'm building a set of related languages to generate a web site. You could call it a graphical version of WebDSL, but I started before I learned about that one.

One of the nice tricks I want to use (see also ME+ Web Application example) is define forms based on attributes of different entities. Instead of abusing UML and its Qualifiers, I created an entity language and a process/form language, where I specify which attributes from different entities to display/edit in the forms.

Here's what I have right now

1) My Form object has an attribute 'Attributes', which is a Collection of Attribute (Attribute is of course an Attribute of an Entity)
2) I fill this collection using the Component Selection Tool
3) I display a list of selected attributes in the Form symbol, which shows the attribute name

And here's what I've been staring at for the past hour:

Multiple entities in my model have attributes of the same name (e.g. name, startdate and so on). How can I change the generator that I use to display the Attributes of my form in such way that it displays something of the form 'Entity.Name : Attribute.Name'?

Here's the generator I use now:

'Attributes'; newline;

dowhile :Attributes
{ :Name; newline; }


EDIT:
Another question just came to mind. Some of the form fields are not related to attributes, but rather to relations between entities. Is there a way to select these related entities into my form as well - possibly using the Object Selector, so I can create droplists for 1:m relations?



Replies:
Posted By: stevek
Date Posted: 17.Nov.2009 at 11:55
At the moment an Attribute has no link to its Entity. You can find the right Entity dynamically though, by searching through the entities to find that Attribute. If you are in the
Attribute in the form, the following will print out the name of the Entity that contains that Attribute.
 
do graphs where type = 'Entity Language'
{  foreach .Entity
    {  do :Attributes; where oid = oid;2
        {  id
        }
    }
}
 
Obviously this is O(N^2) and pretty naive. If you want something more scalable, try adding the Entities or Entity graphs to the Form graph as "include" references. That way you significantly reduce the search space, and also make it more understandable.
 
The other option is to include explicit links from Attribute to Entity, and maybe from Entity to Database (if you have such a thing). If you copy the Entity, it's easy to go through each of its Attributes and paste the Entity into a 'Parent Entity' field in the Attribute's property dialog.
 
In all cases you can make the symbols or a checking report show if there are problems, e.g. 'Attribute not found' - making the font red for that Attribute reference is a simple way.


Posted By: Angelo
Date Posted: 17.Nov.2009 at 22:23
Thanks Steve, that should solve it (and answers both questions).

EDIT: provided I change oid;2 to oid;3 ;-)

'Attributes'; newline;

do :Attributes
{
do graphs where type = 'EntityDiagram'
{ foreach .Entity
    { do :Attributes; where oid = oid;3
        { id;1; '.';
        }
    }
}
:Name; newline;
}




BTW, nice webinar this afternoon, I even spotted a nice example, from a certain contest in The Netherlands.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net