Re: Very interesting case
Re: Very interesting case
- Subject: Re: Very interesting case
- From: Chuck Hill <email@hidden>
- Date: Tue, 22 Sep 2009 13:52:32 -0700
On Sep 22, 2009, at 12:23 PM, Don Lindsay wrote:
It is using the WONavigationBar component from WOExtensions. It is
a hyperlink, inside that control.
That would leave you .... (rhyme with duct). That works fine to
navigation, but does not handle data submission.
The answer is, of course, Wonder. ERXBatchNavigationBar appears to do
what you want.
Or you can make your own navigation that uses WOImageButton to change
batches.
Chuck
Don
On Sep 22, 2009, at 12:22 PM, Chuck Hill wrote:
On Sep 22, 2009, at 2:32 AM, Don Lindsay wrote:
Hello;
I have a displayGroup displaying batches of 5 items per page.
When a user clicks the next page,
What is "clicks the next page"? If it is a WOHyperlink then the
form values will not get submitted. You need to use a
WOSubmitButton to send what the user entered to the app.
Chuck
which uses displayNextBatch() for the display group, if the user
goes back to the previous page, all of their answers have been
cleared as if they never entered anything.
If I use a WOSubmit button to submit the changes and use
saveChanges on the EO everything stays selected. But should a
user be required to do this everytime they go to another batch?
Is there something I can do to retain selected values across
batches for when a user returns to the page, without issuing a
savechanges via a WOSubmit?
This is a very vanilla form, no code that is manipulating the EO
objects, it is all done through WO Controls ,WORepetitions, and
display groups.
Thanks
Don
On Sep 21, 2009, at 10:45 PM, Chuck Hill wrote:
On Sep 21, 2009, at 2:16 PM, Don Lindsay wrote:
I know, I have been piddling with it and probably violated many
commandments.
That is not something that you can do and expect sane results.
It is a binary sort of thing. Either you lock correctly and obey
the commandments, or EOF.doCrazyThingsAtRandom(true). Your call.
You seem to have found a work around, but that does not address
why the EO was not getting saved. I strongly suspect that you
have a latent bug lurking in the background.
Chuck
Let me explain what I am doing and see if anyone has any insight.
I have a datamodel with the following:
Users (identifier Integer, username string, password string)
Pages (identifier Integer, PageDescription string, active
integer, position Integer)
Questions (identifier integer, questiontext string,
pageidentifier integer, active integer)
Question Lookup Values (identifier, descriptivetext string,
active integer)
UserAnswers(identifier integer, useridentifier integer,
questionidentifier integer, answeridentifier integer)
Pretty simple. A user can access any page, any question on a
page, and answer a question only once. So I created an entity:
useranswers ( User, Question, Answer(would contain a question
lookup) )
Pages can have one or more questions,
Questions can have zero or more Question Lookup Values.
More than one question can relate to a question lookup value.
So the relationship looks like this:
Pages <-->> Questions <<-->> Lookup Values
User <-->> UserAnswers <<--> Question
So what I have done is create a component that takes a User as a
property when it is created setUser(...).
I then created a WODisplayGroup for Pages with no detail.
I then created a WODisplayGroup for Questions with detail
pointing to pages.
I then created a WODisplayGroup for UserAnswers with detail
pointing to questions.
The issue I have with the UserAnswers displaygroup is that it
also requires a qualification to a User as well as a question.
Noooo problemo, I use the
queryMatch().setValueForKey(theUserObject,"theUser").
Now here is where I run into issues, Question.theAnswers
relationship returns an NSArray because it is a to-many. How do
I bind this to the selection property of a WOPopupButton, I
can't that I know of. <<Violation of every commandment known
occurs here>>
Don
On Sep 21, 2009, at 4:31 PM, Chuck Hill wrote:
On Sep 21, 2009, at 1:17 PM, Don Lindsay wrote:
Hello;
I have a component that I am updating a table of answers based
on selections made by the user from a worepitition.
The code being executed is:
try {
String sEoQualifierText = "page=";
sEoQualifierText +=
Integer.toString((Integer)thePage().valueForKey("identifier"));
sEoQualifierText += " and question=";
sEoQualifierText +=
Integer
.toString((Integer)theQuestion().valueForKey("identifier"));
sEoQualifierText += " and user=";
sEoQualifierText += Integer.toString((Integer)
((EOEnterpriseObject)theUser).valueForKey("identifier"));
EOQualifier oQual =
EOQualifier.qualifierWithQualifierFormat(sEoQualifierText,null);
What are you doing? And why? What is
thePage().valueForKey("identifier")? Home brew binding sync?
Generic Record based EOs with no Java classes?
Wonder's ERXQ will make your life so much easier to read and
maintain.
EOFetchSpecification oFetch = new
EOFetchSpecification("UserAnswers",oQual,null);
NSArray aAnswer =
oEO().objectsWithFetchSpecification(oFetch);
oEO().lock();
Nooooooooooooooooooooooo.
<runs away screaming>
Why lock like that? Why not just gouge your eyes out and
hammer pencils into your ears? It will be quicker and less
painful and just as effective.
Locking like that is useless and wrong and just won't work.
Ever. Use ERXEC or the MultiECLockManager. Your chances of
doing it right another other way approach null.
((UserAnswers
)aAnswer
.objectAtIndex(0)).setTheAnswer((QuestionLookup)theAnswer());
//
((EOEnterpriseObject)aAnswer.objectAtIndex(0)).willChange();
oEO().unlock();
//System.out.println("updates to be saved: " +
oEO().updatedObjects());
oEO().saveChanges();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
System.out.println("hissssss, didn't work");
}
if (theAnswer!=null) {
System.out.println("append to response firing "+
(String)theAnswer.valueForKey("desc"));
} else {
System.out.println("append to response firing but the
answer is null");
}
ThePage is an item from a listing of available pages repetition.
TheQuestion is an item from listing of questions repitition.
TheUser is the user who is currently working with the page.
The entity has 4 attributes (user, page, question, answer).
When I turn on EO Debugging I see that an update is made, but
when I check the database the answer is always null. I do not
get any errors in the logs. If I had an error I could start
working it out.
Anyone have any ideas?
My money is on "incorrect EC locking" followed by "violating
EOF commandments". This is the classic symptom of doing either
(or both!) of those.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase
their overall knowledge of WebObjects or who are trying to
solve specific problems.
http://www.global-village.net/products/practical_webobjects
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden