November 13, 2013 at 12:01 pm
I am trying to create a report subscription on the fly, then fire the subscription, then delete the subscription immediately after. I have the first two steps figured out, but what I have realized is that if you don't give the report time to execute, it will get deleted first. I threw in a Sleep just to give the report I am testing time to run. But since this execution time varies immensely, i need something more reliable. Is there a way to check to see if the subscription is running, or has just finished, before deleting the subscription? The core of my code looks something like this:
Dim NewSubID As String = rs.CreateSubscription(rptName, extSettings, rptDesc, eventType, matchData, Nothing)
Dim MySubs As Subscription() = rs.ListSubscriptions(rptName)
For Each SubX As Subscription In MySubs
If SubX.SubscriptionID = NewSubID Then
rs.FireEvent(SubX.EventType, SubX.SubscriptionID, Nothing)
Threading.Thread.Sleep(20000)
rs.DeleteSubscription(SubX.SubscriptionID)
End If
Next
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply