Forums BIRT Reports Displaying A non Persistent field from a table in BIRT

This topic contains 2 replies, has 3 voices, and was last updated by  joe_dallesandro 2 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #113

    ani_difranco
    Participant

    HI Guys, I am designing a very simple report in BIRT for Maximo 7.1 .The tables that are used in this SR[Service Request] and CLASSSTRUCTURE Table in Maximo database. The Column and the Fields that are going to be displayed in the report are as follows TABLE COLUMN SR TICKETNUM SR ASSETID SR BCUSTOMERNAME SR BCUSTOMERADDRESS SR BTELEPHONEHOME SR BTELEPHONEMOB SR BTELEPHONEWORK SR REPORTDATE SR REPORTBYID SR BCALLERNAME SR BCALLERTELMOB CLASSSTRUCTURE HEIRARCHYPATH The problem here is that CLASSSTRUCTURE table does not have a persistent HEIRARCHYPATH column in it that means this column doesnt exist in maximo databse table of classstructure. Now can anyone please throw some light on the thing that CAN ONE PULL A non persistent Column into BIRT dataset for this report [e.g let us say Dataset1] .If yes Please kindly explain. Please this is urgent do send in your responses. If you require more info on this also let me know. I will post the same Thanks

    #114

    debbie_harry
    Participant

    From Maximo Perspective If one goes into Database Configuration by logging into Maximo 7.1 and searches for CLASSSTRUCTURE object i.e table .One can find in the Attribute tab [That is column] that HEIRARCHYPATH is present as a Non- Persistent Field. So any suggestion of manually entering the field into the CLASSSTRUCTURE table ccannot be done in maximo . Our aim is to pull this non persistent field called HEIRARCHYPATH and show it on the rptdesign along with a label called Classifcation : row[“HEIRARCHYPATH”] If any more clarification is needed..kindly reply in.

    thanks

    #115

    joe_dallesandro
    Participant

    Hello,
    i believe my solution can help to somebody.

    Im using Maximo 7.5.0.3 and SQL server 2008.

    All u need is to use nested dataset.
    maximoDataSet.open()
    {
    maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());
    maximoDataSet.open();
    var sqlText = new String();
    sqlText += “select assetnum, classstructureid from asset ”
    maximoDataSet.setQuery(sqlText);
    }

    DataSet fetch method is called for every row of selected data.
    so we need to create our dataset in the fetch method.

    maximoDataSet.fetch(){
    if (!maximoDataSet.fetch())
    return (false);

    row[“assetnum”] = maximoDataSet.getString(“assetnum”);

    //gets asset.classstructureid
    var classstructureid = maximoDataSet.getString(“classstructureid”);

    var hierarchypath = new String();
    if( classstructureid != null) {
    downtimeDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), “classstructure”);
    downtimeDataSet.open();

    var downSql = ” with Hierarchy(classstructureid, parent, Level) ”
    + ” as ”
    + ” ( ”
    + ” select classstructureid, parent, 0 as Level ”
    + ” from classstructure l ”
    + ” where l.classstructureid = ‘” + classstructureid +”‘”
    + ” union all ”
    + ” select l.classstructureid, l.parent, ch.Level + 1 ”
    + ” from classstructure l ”
    + ” inner join Hierarchy ch ”
    + ” on ch.parent = l.classstructureid ”
    + ” ) ”
    + ” select Hierarchy.*, classstructure.classificationid ”
    + ” from Hierarchy ”
    + ” join classstructure on classstructure.classstructureid = Hierarchy.classstructureid ”
    + ” order by Level desc “;

    downtimeDataSet.setQuery(downSql); // gets classstructure hierarchy of our classification

    while (downtimeDataSet.fetch()) { // adds ” \ ” between recrods
    hierarchypath += downtimeDataSet.getString(“classificationid”) + ” \\ “;
    }
    downtimeDataSet.close();

    // removes ” \ ” after last classification
    hierarchypath = hierarchypath.substring(0,hierarchypath.length -2);

    row[“hierarchypath”] = hierarchypath;
    }
    return (true);
    }

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.