1

Scripting value box property changes with an asset template

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?

2 replies

null
    • System Integrator
    • derwyn
    • 1 yr ago
    • Reported - view

    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.

    • laruer
    • 1 yr ago
    • Reported - view

    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") );
    }
    

Content aside

print this pagePrint this page
  • 1 Likes
  • 1 yr agoLast active
  • 2Replies
  • 140Views
  • 4 Following