Hi,

I am developing a Wonder D2W application. When I use a class method to
display a derived attribute, say a full status or a full name, I am able to
correctly display the attribute in a D2W listing for example, but then I
lose the listing ability to sort by the derived attribute.

I then created the derived attribute directly in my EOModel, with the same
name and no class method for it. For simplicity, take this example. The
status attribute is an integer number, a code for the status. 0 represents
inactive, 1 active. So I created a derived attribute fullStatus with the
following SQL (tested in a MySQL query):

case 'status'
when 0 then 'Active'
when 1 then 'Inactive'
end

This is the error I get when executing the application:

ERROR er.extensions.appserver.ERXApplication  - Exception caught:
sqlStringForAttribute: attempt to generate SQL for attribute 'fullStatus'
on entity 'Party' with undefined column name. You must define a column name
for this attribute before attempting a database operation.


I searched the list and googled for a similar problem but found none. The
entity plist part regarding the derived attribute is this:

{
columnName = "fullStatus";
definition = "case 'status' when 0 then 'Active' when 1 then 'Inactive'
end";
isReadOnly = Y;
name = "fullStatus";
prototypeName = varchar16;
userInfo = {"_EntityModeler" = {generateSource = NO; }; };
},

It seems a little odd to me, since I did not expect a derived attribute to
have a columnName.

With the solution to this problem I intend to learn how to work with
derived attributes and confirm if a D2W listing will indeed be able to sort
by the derived attribute.

Thanx in advance,

Angelo


PS: by the way, EOModeler seems very unstable. For example, when generating
migrations, instead of this

partyTable.addForeignKey("personID", "Person", "id");
it generated this

partyTable.addForeignKey("personID",
"${relationship.destination.externalName}",
"${join.destinationAttribute.columnName}");

EOModeler will sometimes corrupt the model file in a way that I am forced
to delete the entities that I changed prior to saving, then I quit it and
start the work all over again.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to