JL

Hello,

I have a problem : I want to update matrix model by script and it doesn't work...

The non working function is : matrix.createHeaderCell ( MatrixHeaderCell cellToInsertBefore, ObjDef objDef, int symbol, int size, boolean rowHeader )

See script code below :

function MiseAJourMatrice(tabObj_objLigne, tabObj_Colonne, matrice, numSymb_Ligne, numSymb_Colonne){

    var matrice = matrice.getMatrixModel();

   

//Récupère les entêtes (en ligne et en colonne) de la matrice

    var rowHeader    = matrice.getHeader(true);

    var columnHeader = matrice.getHeader(false);

    var rowCells = rowHeader.getCells();

    var columnCells = columnHeader.getCells();

       

    for (cptligne = 0; cptligne < tabObj_objLigne.length; cptligne++)

    {

        var result = new Array();

        result = getMatrixHeaderCellByObjDef(tabObj_objLigne[cptligne],matrice,true);

        if(result[0] == 1)

        {

//            matrice.deleteHeaderCell(result[1]); // deleteHeaderCell correctly works, if matriching ObjDef founded, the row is deleted

//  only for testing and debugging

        } else

        {// If Object not founded, a new row in the HeaderCell should be created but it doesn't works

            var cellLigne = matrice.createHeaderCell( null , tabObj_objLigne[cptligne], -1, -1, true);

        }

    }

 

    for(var cptcol = 0; cptcol < tabObj_Colonne.length; cptcol++)

    {

        var result = new Array();

        result = getMatrixHeaderCellByObjDef(tabObj_Colonne[cptcol],matrice,false);

        if(result[0] == 1)

        {

//            matrice.deleteHeaderCell(result[1]);

// only for debugging, deleteHeaderCell correctly works, if Object if founded, the column is deleted

        } else

        {

            var CellCol = matrice.createHeaderCell( null , tabObj_Colonne[cptcol], -1 , -1, false);

            var toto = "stop"; // Break point for checking variables during debug

        }

    }

    return matrice;

}

 

function getMatrixHeaderCellByObjDef(objDef,matrice,isRow){

    var result = new Array();

    result[0] = 0;

    matrice = matrice.getMatrixModel();

    var header = matrice.getHeader(isRow);

    var headerCells = new Array();            

    headerCells = header.getCells();

    for(var i = 0; i < headerCells.length; i++)

    {

        if (headerCells[i].getDefinition().IsEqual(objDef))

        {

            result[1] = headerCells[i];

            result[0]++;

            break;

        }

    }

   return result;

}

When I put a break point on bold line

CellCol : com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AMatrixHeaderCell@51252b39

CellCol.getDefinition() : Wrapped java.lang.NullPointerException

tabObj_Colonne[cptcol] : ObjDef ID=cut###22e###p##

I understand that the HeaderCell is created but with empty content (nullPointerException)

I tried to change null parameter with an existing HeaderCell, -1 Symbol and -1 Size with Object Symbol or Column Size, the result is allways the same, it doesn't work...

Is there any bug known with ceateHeaderCell function or is there anything wrong on my code ?

Can you help me ?

Thank's

by Jean-Philippe Legoupil Author
Posted on Wed, 08/24/2016 - 09:50

Hello,

 

I finaly found half of the answer for my problem with another script existing in my database and working fine for creating and updating header cells :

On my previous script, I opened my database with this code :

     var database = ArisData.getActiveDatabase();

If I open my database with other filter with this code :

    var database2 = ArisData.getActiveDatabase();

    var databaseName = dataBase2.Name(Langue);

    var database = ArisData.openDatabase(databaseName, adminUser, adminPassW, guidFiltreGlobal, Langue, false);

My script works a little bit better :

I can now create headercells on new matrix models created from scratch with my script, but I can't update an existing matrix previously created by the same script ?????

The other script existing on my database and using the same function works for creating and updating (adding) headercells but with other objects and links on rows and columns...

So my new questions are :

    - what should I verify on database filter (?) for being able to create and update by script my matrix models ?

    - Is it possible to have my script working without admin rights ?

    - What is the difference between a new matrix model created from scratch with my script, and an existing model previously created by the same script ?

 

And I don't understand why I can with my user login create manually the matrix, add or delete header cells, add or delete links, and I can't do that with scripting. And when it is possible by script to delete matrix HeaderCells, why should I change filters or login access to database to create new HeaderCells ???

 

Thank you for your help...

 

 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock