Perspective fill in table with values and styles

So the documentation says I should use a dataset to fill in the table, can I put a style in that data set as well? If not should I run through the table twice, once to create the dataset and then again to set the styles of each object in the data? I was told to use styles for row color and that would be applied to each cell.Thx, Jake

The generally recommended approach is to retrieve your data at the top level of the binding (via query, HTTP binding, whatever) and then use a script transform - you can loop through the result rows and add a style key as appropriate. Take a look at this thread for some inspiration; it’s a bit more complicated than you might need (supporting per-column cell styling) but should be an inspiration:

So that looks pretty cool. The data comes from tags so as far as I know there’s no short cut, just have to build it out. I have the styles in the project so I’m assuming I can just do something like styles.white or whatever. Seems like I need to go through once and build the tables values and then style them with another pass.

So do I need to loop through twice, just want to confirm?Thx, jake

Well, that would depend on exactly what you’re doing. You mentioned bringing in tags, but how, exactly? If you’re using scripting it should definitely be possible to add style references without a second loop (although a second loop is not likely to be a performance bottleneck - it’ll all happen on the gateway).

So I have like 15 udt’s and about 500 units. The udt’s are for a type of unit, and groups of units and such. This was all fleshed out in vision years ago and being migrated to perspective. When you log in it takes the login, usually customer, and builds out a table with only that logins units. The table has unit number, customer, location and voltage. The line will be a color based on the units status, a tag within each of the udt’s. We are constantly adding, deleting and moving units so there’s really nothing I can set in stone.Thx, jake

Ah, okay, so this is housed in some dataset somewhere? If so, then, yeah, you’ll probably want your top level binding to be direct to that dataset, and then use a script transform to go through it and build out your inline styles.

It’s not housed anywhere. There’s a tag with comma separated values I use split on to get the unit numbers. Those unit numbers have a tag in their udt that has the status I use to color the row, along with the location company and the volts that I fill in the row values with.

So I saw some code for rows creating objects with values and styles, this seems the best way. How do add this to the table, just single dimension array of objects sent in as a dataset?Thx, jake