32
Views
5
Comments
Solved
###### How do you plot Values into Matrix table?
Application Type
Traditional Web

I want to make the logic to plot the values into Matrix Table according to Data List.

The display in Screen is like this.

I'm trying to implement it in Preparation, but it doesn't work and I'm stuck on that.

The logic I'm thinking is

1: In case that Count1 equals 1, filter the List with Count1.

2: Then, plot the values of "Plot Value" into Matrix table according to "Plot Pos",

Let's say PlotPos is 2.0. In that case, Row value becomes 2 and Cell value becomes 0.

Put the "Plot Value" AAA in the right position in Matrix table.

Are you familiar with how to implement this logic ?

I've attached my oml file for details.

I'd appreciate it if you could give me good advice on the above question.

I look forward to it.

Best,

CellRowTable.oml

Solution

Yes, i saw the other post with similar question.

The part I wasn't really getting is why it had to be done in javascript, but I'm glad you found the solution and can get on with your project.

Hi Tsubasa,

you would do yourself a big favour by making sure your datamodel better fits your needs.

It's hard to give any advice without understanding what you are trying to achieve.

Like,

how are your data going to be populated, user input, some external source, ...?

what does it mean when count1 attribute is not 1 ?

how will you prevent multiple values in same plot position, or is that allowed ?

do you have a fixed number or maximum number of rows and columns in your matrix ?

And this is a personal pet peeve of mine, why on earth not call the first column 1 ???

But more importantly, please tell something more about what your use case is, this plotting of random values is very abstract idea, what is your matrix going to represent ?

Dorine

Oh ,sorry. Let me go into details.

Firstly, I'm trying to implement the below logic in order to make what I want.

I want to dynamically put a string in the designated cell in table with Javascript.

For example, if I have this kind of condition of local variables,

rowNum=3, colNum=2, Label="StringSTR"      (rowNum means the row, colNum means the column.)

the string of "Label" is inserted into the designated cell and it displays

But it doesn't work  and I can not figure out where I'm missing.

The code in Run Javascript is like this.

```"
var tableElem = document.getElementById('tablematrix');
var rowElems = tableElem.rows;
var rowlen = rowElems.length;
var rownum,colnum;

rownum=" + rowNum + ";
colnum=" + colNum + ";

rownum=rownum+1;
colnum=colnum+2;

var colthis=rowElems[rownum].cells[colnum];

colthis.innerHTML+=" + Label + ";

"```

I wonder if I have the wrong Javascript coding. Is it possible to make this kind of function with JavaScript to insert a value into a cell in OutSystems?

I'd appreciate it if you could give me some good advice.

I have attached my oml file for your information.

Best,

MATRIXcell.oml

I solved by myself.

Solution

Yes, i saw the other post with similar question.

The part I wasn't really getting is why it had to be done in javascript, but I'm glad you found the solution and can get on with your project.

mvp_badge
MVP

two replies were incorrectly marked as solution, I undid both of them. Please only mark a reply that is truly a solution.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.