![](https://s3-us-west-2.amazonaws.com/media.forumbee.com/avatar/861bd75fe759018ee33e5661417e6c03-1631372758000/h/40.jpg)
Scripting value box property changes with an asset template
![](https://s3-us-west-2.amazonaws.com/media.forumbee.com/i/ec7f4794-eff3-44a3-aeb2-27bff2927937/h/547.jpg)
I have some controls at the top where users can select a date and shift. I have scripting on the controls to update the aggregateinterval and aggregatestarttime on some value boxes. Maybe a better way to do it but it seems to work. When I tried to use it for an asset template though, I ran into issues because all the value boxes have different names. I might could do it but I think it would take a little while to script so many controls. Is there another way I might could do this?
-
James, Hi,
This is similar to something I was attempting. I was able to apply a common start & end time to all value boxes within my asset template by only applying the script result to the 1st set of value boxes in asset card #1.
I did rename the first set of value boxes (asset card #1) and used the names in the script. I applied Aggregatestarttime to 2 x value boxes in Asset card #1 and all the other cards(assets) followed.
-
Hi James,
If you want to change all the ValueBoxes on the same page when you update the DateTimePicker then you can use the following code for the OnDateTimeChange event.
public void DateTimePicker1_OnDateTimeChange(object sender, DateTime dateTime) { Screen.ScreenControls.Where(c => c.Kind == ControlKind.ValueBox).ToList().ForEach(c => ((ControlValueBox)c).AggregateStartTime = dateTime.ToString("o") ); }