OK. I think this will work for what you’re trying to do:
var compName = $D.job.get("compname"); var layerName = $D.job.get("layername"); var layerTime = $D.job.get("time"); var myComp; for (var i = 1; i <= app.project.numItems; i ++) { if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name === compName)) { myComp = app.project.item(i); break; } } myComp.layer(layerName).startTime = layerTime;I’ll explain the methodology briefly here so that you can adjust as needed. The comp name is set by the “compname” field in the data source (more on that in a second), the layer by “layername”, the time value by “time”. These values can obviously be altered to fit your project as needed.
The code that begins with var myComp; is essentially a quick loop that searches your Project for the text outlined in the compName variable and returns the index value. That way, you can pick the comp using plain text rather than an index. The layer name within the comp can be designated by text, so that’s what the layerName variable is for.
I tested this on the “Before layers update” event, and it seemed to work without an issue. It’s possible there might be some issues if you have a huge number of layers that all need updating, but this should be a good starting point. If you run into trouble, feel free to let us know, and we’ll see what we can do. Thanks!