on 12-10-2008 5:12 AM
Hi All
I have context node structure like
Question (node)
|--- qid (attribute under Question)
|--- qtext (attribute under Question)
|--- Answer (node)
|--- aid (attribute under Answer)
|--- avalue (attribute under Answer)
Is there any way to access DIRECTLY the value of avalue if i know the value of qid and aid?
Please help
Regards
Sonal Mangla
Hi,
Looks like you have multiple Questions with multiple choice answers.
If you know the qid & aid, you have to iterate through the question node elements to find the particular question whose id is qid (for loop with size of QuestionNode). After finding that que node element, in that you will have multiple answers i.e multiple answernode elements will exist. So you have to again iterate through the Answer node (for loop with size of answerNode) to check for the element with given aid value. When you get that, get the corresponding avalue.
I am not sure how it could be done in a more direct way. In case you are able to implement, do share the same.
Regards,
Anagha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sonal,
I suppose that you want to the implement the logic as you mentioned to reduced the iteration through the entire questions nodes which would be of course 1..n cardinality node.
If that was my requirement I would have implemented it in following way.
- The question node structure with cardinality 1..n
- Answer node is declared as SINGLETON - true.
- Assigning supply functions for the answer node/attributes
- Adjusting the lead selection based on the qid
The above solution will not only fulfill your requirement but it would also prevent your context memory size from blowing up if your answer choices are huge set of text string in multiple.
Please let me know if this helps you.
regards,
Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure if I understand your question completely but if you want to avoid looping through the "Question" node to find the question with the given ID then you could for example store the (question, answers)-pairs using a map and access the list of answers for a given question ID directly.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you need to have Parent and Child nodes relationship for your purpose. That is you need to have qid attribute in your Answer node also mapped to Question node, which behaves as primary key and foreign key references.
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.