如何在Spotfire的ProgressOperation中屏蔽“Executing Function...”提示?
Hey there! The back-and-forth between your custom "Gathering Data..." message and the system's "Executing Function..." is happening because ReloadLinkedData() fires up its own internal progress reporting. That internal progress context overrides your main one temporarily, causing the annoying flip.
Here's a clean way to block that system message and keep your custom status visible the whole time:
Solution: Wrap ReloadLinkedData in a Silent Subtask
We'll create a "silent" nested progress subtask that absorbs all the internal progress reporting from ReloadLinkedData() without showing any new messages. This keeps your main progress context in control:
stepCount = self.Document.Data.Tables.Count with self.progress_service.CurrentProgress.BeginSubtask("Gathering Data...", stepCount, "Step {0} of {1}") as main_progress: for dt in self.Document.Data.Tables: if dt.NeedsRefresh: to_be_refreshed = List[DataTable]() to_be_refreshed.Add(dt) try: # Create a silent subtask to contain ReloadLinkedData's internal progress # Empty strings mean no new status messages will be displayed with self.progress_service.CurrentProgress.BeginSubtask("", 1, "") as silent_progress: self.Document.Data.Tables.ReloadLinkedData(to_be_refreshed) # Optional: Report progress on the silent subtask to avoid hanging states silent_progress.TryReportProgress() except SystemError: # Ignore error if table didn't actually need a refresh pass main_progress.TryReportProgress() main_progress.CheckCancel()
How This Works
When ReloadLinkedData() runs, it looks for the current active progress context to report its status. By wrapping it in a silent subtask, we give it a context that doesn't output any visible messages. Your main progress context stays active and continues showing your "Gathering Data..." message without interruption.
Alternative: Temporarily Replace Progress Context
If your progress service allows direct context replacement, you can swap in a no-op progress handler while running ReloadLinkedData():
stepCount = self.Document.Data.Tables.Count with self.progress_service.CurrentProgress.BeginSubtask("Gathering Data...", stepCount, "Step {0} of {1}") as main_progress: for dt in self.Document.Data.Tables: if dt.NeedsRefresh: to_be_refreshed = List[DataTable]() to_be_refreshed.Add(dt) try: # Save original progress context and replace with a no-op original_progress = self.progress_service.CurrentProgress self.progress_service.CurrentProgress = None # Or a custom no-op implementation self.Document.Data.Tables.ReloadLinkedData(to_be_refreshed) except SystemError: pass finally: # Restore original progress context self.progress_service.CurrentProgress = original_progress main_progress.TryReportProgress() main_progress.CheckCancel()
Note: This second approach depends on your progress service allowing CurrentProgress to be set to None—if that throws an error, stick with the silent subtask method.
Either way, you'll stop seeing that annoying "Executing Function..." message and keep your custom progress status consistent.
内容的提问来源于stack exchange,提问作者Cody Mayers

