Message 1 of 4

Not applicable
02-28-2018
01:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to use this code for duplicate a schedule view and change the filter value.
The code works, the schedule is duplicated, but the value is not changed. I also tried to commit the transaction and restart it before the filter, and regenerate document but not work.
what am I doing wrong?
Dim lst_viewAbaco As List(Of View) = ED_Utility.FiltraAbaco(_doc, "ED-RDET_ABACO") 'Dim viewAbacoID As ElementId = Nothing Dim viewAbaco As ViewSchedule = Nothing Dim t1 As New Transaction(_doc, "CopySchedule") Try t1.Start() For Each v As ViewSchedule In lst_viewAbaco If v.Name.ToUpper = "ED-RDET_ABACO" Then viewAbaco = TryCast(_doc.GetElement(v.Duplicate(ViewDuplicateOption.Duplicate)), ViewSchedule) Dim lst_Abaco As List(Of View) = ED_Utility.FiltraAbaco(_doc, "Abaco Armature Partizione" & " - " & str_Part) If lst_Abaco.Count = 0 Then If viewAbaco IsNot Nothing Then viewAbaco.ViewName = "Abaco Armature Partizione" & " - " & str_Part Else If viewAbaco IsNot Nothing Then viewAbaco.ViewName = "Abaco Armature Partizione" & " - " & str_Part & "_1" End If _doc.Regenerate() Dim filter As ScheduleFilter = viewAbaco.Definition.GetFilter(0) If filter.IsStringValue Then filter.SetValue(str_Part) End If End If Next t1.Commit() Catch exception1 As Exception t1.RollBack() Return 0 End Try
Solved! Go to Solution.