Pass parameter into embedded view table

Please help. Maybe I am going about this the wrong way. This is an oven log, pretty simple, mark order in and out and retrieve the temperatures for both operations. I would like an additional column added which is a progress bar showing the time remaining on the bake. I went through all the steps included in the documentation, but I seem to struggle with passing parameters into the embedded view in my table. If you look on my last screenshot here, what do I have to do to get the corresponding field (time in / due out) and pass them into the embedded view per row.

I know this seems basic, but I spent literal hours looking for the answer to this question before I posted.
Sorry for that, and thanks in advance

Your data array (or dataset) looks like this:

    "Work Order": "XXXXXXX",
    "Oven ID": "YYYY YYY YYY",
    "Quantity": N,
    "Time In": SomeDateValue,
    "Due Out": SomeOtherDateValue

You need it to look like this:

    "Work Order": "XXXXXXX",
    "Oven ID": "YYYY YYY YYY",
    "Quantity": N,
    "Time In": SomeDateValue,
    "Due Out": SomeOtherDateValue,
    "Remaining Time": {
        "start": SomeDateValue,
        "stop": SomeOtherDateValue

Also - if I remember correctly - the name of the param in the View you are embedding MUST be value (I verified locally that this DOES indeed work). The example in the manual happens to use value and I think some people think it’s just a generic usage. The param in the View should look like this:
Screen Shot 2021-03-29 at 8.28.38PM
With the setup I specified here, you do NOT need to explicitly set the viewParams value for the column configuration; the values will be implicitly supplied to the embedding View.

While making sure I was correct locally, I used the following configurations (using Labels to verify the data was coming across as expected):

  1. This is the View which will be embedded in the Table cell. Note that there is a single base-level param named value, and my two values I need are children of that property. You should replace my string values with date placeholders, or leave them empty and make sure that the binding for your progress bar handles values which are not dates.

  2. This is the binding setup for the two label components in the view which will be embedded. Note that they point to the internal children (start, stop) of the value param.

  3. This is the structure of my data (modified from the default data of the table). The Remaining property is what you should pay attention to as it’s an object instead of a single value. Column cells only have access to the value FOR THEIR COLUMN, and so if you need to pass multiple values to a cell then you need to pass them as part of a single object. Note also that I did NOT supply a Remaining object for my second row - you’ll see the result of that later.Screen Shot 2021-03-29 at 8.43.45PM

  4. This is the column configuration for my “Remaining” column. Note that I am not explicitly setting the viewParams - I am letting the values in my data be implicitly supplied to the View which will be rendered.
    Screen Shot 2021-03-29 at 8.33.31PM

  5. My result. Note that the “A” and “B” values from my data were used instead of the placeholders I had as a default. You can see in the next row that I did not supply any values to the View which is being rendered, and so it fell back to using the default values I had in place.Screen Shot 2021-03-29 at 8.44.17PM

Thank you for the detailed response. I am following, and I can recreate this when I hard code my data, but what I don’t understand how to do is to manipulate that data once it has been grabbed by SQL. Any data properties I create are removed when I bind this to my SQL query.

Is there a way to manipulate the SQL to grab from a table but store a column as a dataset? I don’t know how to store the data as a dataset within a table

You can add a script transform to the binding to manipulate the returned data into whatever format that you need.

You will need to bind your table’s data property with a Named Query binding, and then you’ll need to include a transform with that binding. You’ll need to iterate over each row of the dataset (or you can change the return type to JSON to make it easier) and construct your own array.

OK I couldn’t figure this out but I gave it a good solid try. I put it down for a little while and came back to it, and still can’t figure it out so I am revisiting the help section.

I have tried recreating this every which way I possibly can. I tried the Ignition examples, but nothing I tried would ever actually make any changes to the dataset. Sometimes when I struggle with something I try to create it as simply as I can, with little to no loops and just see if I can structure something appropriately, but nothing It try seems to work. I hate to ask somebody to do this for me, but can somebody give me a push in the right direction?

I understand this example I’m using is a terrible way to do things, but this was my attempt to just manually build a table as easily as possible.

You can see here even in my second example, the most simple of scripts won’t make a change to the dataset.

On that note, why is the scripting languages such a hodgepodge of different languages? I can’t use python help, because half the time the stuff I find on python doesn’t seem to work in the scripting window. The only options I have are Ignition examples, and every person on here seems to assume that I can script whatever I want in this stuff when I don’t even understand what language this is or what rules it follows, what functions or libraries I have available to me. I find it very frustrating as a new user to find such inconsistency with the behavior.

Wow. There’s a lot to digest here…

I can’t even begin to list the reasons, but you have to understand that when you’re dealing with many different pieces of software, you have to use languages that easily interact with all of those pieces, AND which users can “easily” pick up. Java and Python are two of the biggest languages, and so Jython is a natural bridge. When it comes to Perspective, CSS is going to be handy to understand because you’re dealing with web content. That’s just how it is; nothing we can do on our end is going to make it so that you won’t need at least these languages.

Your script example is a little odd, and doesn’t quite line up with what’s expected for data if you’re trying to supply an array.

The Table’s data array expects an array of objects. Each object can have 0-to-many keys within, where each key itself has a value which could be a primitive value or a complex object.

# This array has two objects. Object 0 has two keys which contain primitive
# values and one key which contains an object. Object 1 has only one key
# which is a primitive value.
data = [{"keyOne": 1, "keyTwo": "two", "keyThree": {"innerOne": True}}, {"keyOne": 2}]

In your example, the first object in the array contains an array of objects, where each object contains a key which is the column name. That isn’t any good to you or the Table.

Try this:

pyData = system.dataset.toPyDataSet(value)
dataAsArray = []
for row in pyData:
    new_dict = {}
    new_dict["workOrder"] = row[0]
    # do ^^^ this previous line for each column you want in your data
    timeIn = row[3]
    timeOut = row[5]
    new_dict["timeIn"] = timeIn
    new_dict["timeOut"] = timeOut
    new_dict["progress"] = {"timeIn": timeIn, "timeOut": timeOut}
return dataAsArray

This should get you data of the shape:

data = [{"workOrder": <workOrderValue>, "timeIn": <someTime>, "timeOut": <someOtherTime>, "progress": {"timeIn": <someTime>, "timeOut": <someOtherTime>}}]

In your second example, you are returning the dataset IMMEDIATELY, and so your attempt to return newData will NEVER be reached. Remove the return value line and you’ll see a difference.

Awesome explanation. I can follow this programming much easier, and I can recreate, but now I have an interesting set of circumstances. When updating the code, I found that my progress bar would work as expected for only a brief period of time then stop working.

Let me explain through my thought process. When it first worked, but then immediately didn’t, I thought that the parameters were expecting an object named value with the start and stop parameters.

Step 1 is me adjusting my script transform and getting the expected result from my dataset.

Step 2 - As you can see on the table, the progress bar is already filled, although the ‘value’ for this progress bar should just be calculated by a datetime function. I used those same data values and manually plugged them into the embedded view to make sure that the parameters were being passed in the correct format, and success. Progress bar works with data entered manually.

Step 3: Comment out the progress line that I added. changed the progress bar to only contain two parameters. As soon as I go back to the perspective session it appears to work. As long as I don’t press anything, it will work; however, If I press the toggle for preview mode it throws up errors.

Is this throwing up errors due to the ‘value’ for this progress bar being calculated? Is this perhaps beyond the capability of an Ignition perspective table? I was hoping this table would be able to give dynamic feedback for our operators. Any idea what I could be doing wrong?

Thank you in advance for the awesome support

Don’t put your progress into a “value” object - just pass the progress object. The view you will be using MUST expect a value object as the param, but behind-the-scenes we are taking the data for the column and placing it into a value object ourselves. Your code would result in something like this arriving to the instanced view:

value: {
    value: {
        start: <some_time>
        stop: <some_other_time>

So please use the code as I provided it:

    new_dict["progress"] = {"timeIn": timeIn, "timeOut": timeOut}

This will result in the embedded (instanced) view expecting a param shape like this (because we take the true value of the cell and jam it into a param named value) :
Screen Shot 2021-04-12 at 5.18.30 PM

Something you could also do is place a chnage script on the value object of the instanced view which prints the new value:


This will allow you to see the shape of the object coming through at a given time.

Also, from your screenshots I’m inclined to believe that something is not quite right with your dates; some of those values look like strings (green text) and some look like dates (grey text with a calendar icon to the right). If your value types are mismatched then you would absolutely encounter errors. You should safeguard your logic to be resilient to these potential mismatches of type so that you can convert them to something you can safely use.


I agree about the dates. I have already checked my incoming dates format and the data as it is stored in the database, and both seem to match.

It seems to be when the data is fetched by the query, for some reason, but I am not sure why it is grabbing them in different formats. I tried importing a couple java libraries to try and reformat the data in the script transform but just got compile errors when trying

2 posts were split to a new topic: Dataset json content passed as string within table