Filter/Search/Order table in multiple collums

tablerow

#1

I have a table that list certain informations. First I do a SUBMN to list some codes.
And then, with this codes, I do some DBR to complete other columns.
The problem is, I can filter this table or search by the code, but can’t with other columns.I would also like to sort the columns, as I do for the code, but using DBRs is not being possible, sorting the key in the table using MDX.

Follow prints of our current tables, as you can see in the first column we do an ordering and we can search for codes, we would like to replicate this ordering and search for all the fields.


#2

Hi @diegopg8,

There a re a number of ways that you can store the values of those DBRs for order manipulation. If you have a row object that you are using in there, you can store the values of those DBRs along those row objects. For example,

<div ng-repeat="row in rows">
  <tm1-ui-dbr … ng-model="row.col1"></tm1-ui-dbr>
</div>

After storing them on each row object, you can then manipulate the rows by utilizing the values stored on each row via the col1 property.

Another way is to retrieve all the values of the table everytime the SUBNM value changes via:

  • cellsetGet()
  • cubeExecuteMdx()

Both functions can give less overhead and more flexibility but also note that you will have to format the data and structure according to your table needs. This is as both will give you arrays of data that you will have to then structure to feed the 2 dimensional table.


Cheers!
Paul


#3

Paul,

Thanks a lot for the help, the first option we are already using, you could give an example of the use of the elements,

cellsetGet ()
cubeExecuteMdx ()

I found little information on these two points.

Thank you very much

Diego


#4

Hi @diegopg8,
You can find more info and examples for sorting columns with dbr and tableTransform , under samples app sample-table page
your existing canvas install should have the following samples application installed with it.
can access the app through below url user:Admin , no password needed.

http://localhost:8080/samples/#/sample/sample-table
http://localhost:8080/samples/#/help
and look for $tm1Ui at the end for more info on executeMDX and much more

The main idea is if you want the search all columns at once you could just store all the
values for the row in to one string for every row and than when search is changed ng-blur=“filterByAllElementsInRow(searchFieldInput)”, that will for loop through the rows and the strings of all dbrs in the row and with indexOf() function decide if the row to be seen or not.
for example
//// first load all the dbr values into existing table.rows and store them as a single string in a //// table.rows[el][‘storedColumnElements’]

//// object that will be used to search not just the first column element but all row cells. then,
//// for loop

$scope.filterByAllElementsInRow = function(searchField){
for(var el = 0; el < table.rows.length;el++){
  var rowElementsString = table.rows[el]['storedColumnElements']
 if(rowElementsString.indexOf(searchField) > -1){
    console.log("show row" , el);
    $scope.table.rows[el].show = true;
}else{
     console.log("hide row" , el);
     $scope.table.rows[el].show = false;
}

}
}

Hope that helps
Ilia