Hey guys,
This may sound a little trivial but I can not seem to add concept answers when creating a new concept. I am working on a private project and I need a Concept whose datatype is a question and whose answers are investigations( concepts with concept class either labTest or Test). What I intend to do is to display these concepts as a tree in an OPD app such that a doctor would not have to stress much when choosing or prescribing an investigation for a patient. He could just collapse the tree and select the investigations he wanted.
This is what my current code looks like
This throws a Null Pointer Exception( I assume when saving the concept).Before reaching here, I had tried different methods.
- I tried saving the concept before adding the answers, then saving again after I added the answers, But what it would do is create an empty concept with the name i specified, the datatype and everything else, but would not add the answers.
- I added the answers one by one using con.addAnswer(conceptService.getAnswer[i]) in the for loop, and saving afterwards. This still did not work.
Here comes the funny part. I had succeeded in doing this before, just a couple of days ago, but i didnt commit and my machine crashed and I lost that code. I am pretty sure the first point on my bullet list is the method I used. Please I need some help ASAP on what I am missing.
PS please ignore the unnecessary prints, I was trying to keep track of what was happening and my debug server does not work for some reason.