Storyline 3 accessing data in table cells?

Feb 24, 2020

I have seen a lot about adding tables, formatting cells, etc.  But I have never seen anywhere if you can access the data in a cell.  I have a table with various numbers in it, and depending on height and weight values, I need to access a given cell and highlight it.  Is this even possible, and if not, how can I get data from a display that is a 2 dimensional array?

Small sample test story attached.   Thanks

7 Replies
Vincent Scoma

Hi fbs 419,

Great questions! When working with tables in Storyline 3, you do have different formatting options available to you. If you want to highlight specific cells, you can do this by: 

  1. Clicking on the table on the slide
  2. Navigate to the Design tab under Table Tools
  3. Click on the cells you would like to highlight, then click on Fill
  4. Now select the color you would like to use to highlight the cell

We also have a great resource on working with Tables in Storyline 3 here!

Please let us know if you have any questions about this! 

fbs 419

Thanks for your reply.  However, the formatting I need to do is at run time (based on some parameters), not at design time.  [Maybe I need some javascript].  At run time, I enter a height and a weight on a previous slide.  I then need to take those numbers, and highlight the exact square of the table.  So I have 2 issues:

1. At run time, how can I check the values in each cell to see if it is the right cell?

2. Once I discover the right cell, how do I highlight it at run time?

I'm starting to think that this isn't possible.  If not, is there another way?   Thanks

 

 

Lauren Connelly

Hi fbs 419!

Just to clarify, are you looking for the table to change depending on how the use enters/adjusts the height and weight?

If so, you could add states for each of the height/weight answers. This could also be achieved by using Javascript. My expertise is not in JavaScript so I hope one of our community experts can step in and help!

fbs 419

Yes.  I've already written some java script to figure out, based on the height and weight, what the correct BMI value is.  Right now I display it at the top, so that may be a workaround.  But what I wanted was for one cell in the table to be highlighted.  For example, in the slide before the table, if the user entered 170 for weight, and 68 for height, then the cell corresponding to that square in the grid will be highlighted.  

Noel Sapp

You might be able to create a hidden state object the width and height of a single cell. It appears, based on your sample, that all cells are the same. It might be easier to toggle a hidden object to visible and set its X, Y coordinates based on numbers you input. I mean, acting as a transparent overlay, so to speak.

I'm not sure how much control and access you're going to get from a PPT/Storyline table. Even still, what if your user types "170lbs" or "170 lbs." or any other variation other than "170"? How you associate the X, Y position to your grid is another matter entirely. Especially if your player is going to be responsive and resize based on browser size.

I'm speaking from a non-programmer's perspective and just found this topic interesting, btw, so do take my post with a grain of salt :)

I'm curious as to what you eventually come up so please do post back if you find a solution!

fbs 419

I believe tables won't work for this, but with individual rectangles, I should be able to have access to coordinates and should be able to figure out something.  Kind of labor intensive, but may give it a try.  But it would be a nice feature to be able to access table cells with array indices.  I already have code to figure out the indices.  I will post my findings if all goes well.

fbs 419

So I did just prove this can be done, but as I thought, it's labor intensive.  I replaced the table with a bunch of rectangles (it will be around 200 of them).  Each rectangle is named R0_0, R0_1, ... R5_5, etc.  For example, the name R2_1 means it's the rectangle with a height index of 2 and a weight index of 1. [Of course it doesn't really matter what I name them -- this is just so I can recognize them easily.]  I added a new state to each Rectangle, which I call the Active state; this state has a different color than the initial state.  The slide before has javascript code to figure out the height and weight index for the values entered, and sets variables with those values.  Then I have a trigger on each rectangle that sets the state to Active when the timeline starts, depending on the value of the variables.  It works, but like I said, labor intensive.  There must be an easier way.

This discussion is closed. You can start a new discussion or contact Articulate Support.