[Perspective Table] Column Field is a Dictionary Element

If an element of data is like this

{
  "ID": 2180,
  "RecipeName": "Test",
  "Configuration": {
    "ID": 3575,
    "Name": "TestConfiguration"
  },
}

and I’d like to show Configuration[“Name”] inside a column of the table, what should I write in the column field property?
Thank you!

You should do a transform on the binding that is producing data and replace the name key with value. Then it will work as expected.

value["Configuration"]["value"] = value["Configuration"].pop("Name")
return value
1 Like

or just add one, eitherway value will get picked. there is no other way to specify what is shown (that i know off)
image

1 Like

Thanks to both of you!

I have a similar but different issue. I am passing multiple values to a single column on a table, and that column displays a view that needs each of the values.
image

The view assumes the input will be a dictionary, and it uses custom parameters to get the values from the dictionary.
image
My problem is that this functionality broke for some reason after an update to Ignition, and I have not found a good fix for it yet. Is there another way to do this?

I'm not used to putting views in tables, but something doesn't look right to me.
And by "something" I mean "pretty much everything".

  1. That structure doesn't look like what a table accepts. I believe it needs a key for each column, not a value key that contains the columns
  2. your view expects a parameter named value. I don't think it's getting that.
  3. that value parameter in your view... that's not a dict. That's a string.
  4. I'm probably missing things.

Did this ever really work ?

Can you send the json of the 2 views, so we can test things in a designer and maybe fix things ?

Yes, it worked great until we updated. I believe the update was 8.1.26. We use views in our tables all over the place, so it was really helpful to be able to pass a dictionary to the view so it could have multiple pieces of information.

The "style" option allows us to add formatting to the row, so we can have different color rows. Here is an example of a table with different colored rows based on some sort of status.

And here is an example of a table with multiple views for the columns to give us different ways to interact with the data associated with each row.

The view is getting the value parameter, and that parameter is a dictionary object. You are correct that in the Designer, I have put to put a string in the value parameter, but the code can accommodate either a string or a dictionary. If it is a string, it decodes the string and converts it into an object, and if it is a dictionary, it just retrieves the value.
image

2 Likes

Hey, you're right, the table actually accepts this structure as well !
This things is more flexible than I thought it was.

image

2 Likes