Passing Row Value into a Component

What would be the correct way to pass a cell value to my Progress bar component?

Example:

I would like the LineID to be called upon in order to use it for an indirect tag reference in the Progress bar component.

Searching the forums is making me lean towards a message event handler script on the Progress bar component. If so, what would that look like?

Looks like... Perspective maybe? Is your progress bar a view? If so, create A param called rowData as an object and add the keys from the row dataset you want to pull in to use

1 Like

You don't have to. Progress bar is built into the Table component.

  1. Make sure that you name the field. (It looks like you have.)
  2. Tell it to render as a number.
  3. Tell it to render numbers as progress.
  4. Set the range.

For the range, I thought it would auto-scale based on the maximum value. I think this might only be for datasets and the sample table component data in this case is JSON. In your case it doesn't matter as long as you don't expect to display over 100%.

2 Likes

Would that object 'rowData' be on the view, root, or table component?

Thanks! Not sure how I missed that built in feature. Looking great just have to figure out my indirect binding for it now based on the 'LineID' value of the row.

What do you mean, indirect binding ?
How are you populating your table ?

Looking to do something like this:

Oh, so the table rows are hardcoded ?
Then you don't even need indirect binding, is the LineID is hardcoded, just hardcode the tag path too.

The indirect would save me a little time since I could just copy/paste the binding to the 29 data sets.

Then it might be easier to build the whole thing in a script transform on the data property.

Why not make the LineID a parameter for the view, and then use that in your indirect bindings. Then instead of copy/paste the binding 29 times, just use the same view and send the appropriate parameter value?

When you say parameter for the view do you mean props.params, and by view you are implying the perspective view the table is in?

Not sure I understand why I wouldn't have to still copy the binding 29 times since all the data sets already exist in my table?

Can you create an example of what you mean?

Perhaps, I don't understand what you mean when you say Dataset. When I say dataset, I mean an object containing potentially multiple rows of data, which is often bound to a tables data property. Is that what you mean?

Yes.

I can, but it will not be until later, unfortunately. If no one else has offered help by then, I will see what I can throw together.

Wondering if you can help me solve this next problem. I am doing an event script for my table onRowClick so that a Popup action happens with more details of the progress.

I have the onClick working and Popup windows is already configured. The issue comes when I am trying to pass the LineID value of the selectedRow.

{/root/OEEProjectTable.props.selection.selectedRow}
-The above only returns the index value of the selected row.

{/root/OEEProjectTable.props.data[0].LineID}
-This actually returns a LineID value and passes it into my Popup but is limited to being hardcoded to row 0 data.

Is there a way I can combine both to have the value of the data in the selected row?

The property binding selector hierarchy:
image

For simplicity I hardcoded with direct tag binding earlier similar to this:

So in my actual non-test table I have 29 data sets (rows).

‘Data[0]’ is actually exactly what you need. It will contain the data from the annexed row.

1 Like

So what @lrose is saying is that instead of making one binding at a time, you can create one script binding on the data prop. It accepts an Ignition Dataset or a dictionary structure.

Quick overview of setting one up:

I'm assuming here you have a custom prop with just the base tag path, "[Application]OEEProjectTracker". Here you'd create a project script function that takes that path and:

  1. loops over all the tag paths to make a tag list
  2. grabs all the data from those tags at once using system.tag.readBlocking
  3. packs those into a list of rows, e.g. [areaName, lineID, quantity, progress]
  4. converts that list into a dataset using system.dataset.toDataset()
  5. returns that dataset.

Your binding would then automatically apply the dataset to the table, giving the same results you already have but a lot less manually.

1 Like

@dcan87 Specifically, props.selection.data[0].

1 Like

Pretty much, except, I would probably opt for a runScript() expression rather than a script transform. More performant.

1 Like

I was actually about to look up which one was more performant, I know they're technically both terrible for performance if overused but I never remember which is less bad.

EDIT: Yeah, found the thread. Something about transforms adds a really nasty bottleneck to execution. Nothing that matters if your script only executes once every second, but adds up if you have multiple.

As a bonus, with runScript() you'd be able to set up a polling rate naturally, whereas with the script transform, you'd have to call now() in the base expression since otherwise it will never refresh.

1 Like