Hello to All,
I have some problem in my code regarding Tree, Actually i am reterieving presentation linkbase from database postgresql which is in this tree form:
Revenue Global Services Hardware H1 H2 software global financing other other1 other11 other12 other2 total revenue
According to my query, i am reterieving data in this formate:
t1: t2
other1 other
other11 other1
other12 other2
t3: t4:
Hardware Revenue
H1 Global Services
H2 Hardware
software
global financing
other
total revenue
here is my query and code:
q4 = session.createQuery("select distinct r.from.id,r.from.conceptName from XBRLRelationship as r where r.parent.id =:C");
q4.setParameter("C", pPresentationObject);
java.util.List lst3 = q4.list();
Iterator itr3 = lst3.iterator();
while (itr3.hasNext())
{
Relationship objRelationship = new Relationship();
object[] objPConcept = (object[])itr3.next();
objRelationship.FromId = objPConcept[i].ToString();
objRelationship.pConceptName = objPConcept[j].ToString();
q5 = session.createQuery("select distinct r.to.conceptName,r.order from XBRLRelationship as r where r.parent.id = :I AND r.from.id=:ID ORDER BY r.order ASC");
q5.setParameter("I", pPresentationObject);
q5.setParameter("ID", objPConcept[i]);
java.util.List lst4 = q5.list();
Iterator itr4 = lst4.iterator();
while (itr4.hasNext())
{
object[] objCon = (object[])itr4.next();
ConceptName objConcept = new ConceptName();
objConcept.cConceptName = objCon[i].ToString();
double ObjOrder = java.lang.Double.parseDouble(objCon[j].ToString());
objConcept.Order = ObjOrder.ToString();
objRelationship.conceptName.Add(objConcept);
}
objPeriod.Order.Add(objRelationship);
}
Can somebody please sort out my problems, which recursive method\query should i use to merge all subtrees into orginal tree..any source code,article or link will be helpful for me. waiting for kind replies.
Thanks
Janjua