DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug when deleting report sheet which alters the channel references of subsequent sheets.

I use a script to create large layover templates which allow me to compare hundreds of channels for up to 10 files.  In many cases I have parameters that aren't necessary, so I'd like to delete these sheets.  There is a terrible bug in the program that changes the plot channel references for all subsequent sheets and it is making it extremely difficult to do this task.  It happens over several different report templates generated by this script.  Unfortunately it is random so every time I try to get screen shots to show the swap it works.  Please see the screen shot below and assume that, before deleting a sheet, the sheet name, curves, and y axis matched.  Is this a known or resolved bug?  I am using version 17.0.1f6881 SP1.  When the references break I can no longer double click on the chart to change parameters on subsequent sheets.  I am having to save after every few successful deletes and then reopen the latest saved file when it screws up.

 

B shows a correct channel.

C shows the channels plotted on this chart which match the sheet name and y axis.

D shows the references break.

 

B.png

C.png

D.png

   

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 1 of 10
(6,000 Views)

Try using "Call Report.Refresh" in your script.

 

See the following examples on how to programmatically generate reports.  In particular, note how the references are set.  

 

http://www.savvydiademsolutions.com/report.php

 

oCurve2D.Shape.XChannel.Reference = oChnX.GetReference(eRefTypeIndexIndex)
0 Kudos
Message 2 of 10
(5,930 Views)

Is Call Report.Refresh something that is relevant only during the script execution?  I could have made this report a month ago.  Deleting sheets today without even loading a script would cause problems.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 3 of 10
(5,916 Views)

Hi Diesel,

 

The refresh action in REPORT is a separate action that has to be invoked, even in most interactive use cases.  The Report.Refresh() command is only executed (and therefore relevant) when the VBScript is running.  Pressing the "Refresh" icon at the top of the REPORT panel with your mouse causes the same action to happen as running this Report.Refresh() command.

 

You are right that deleting sheets should NOT change the channel references inside REPORT objects on the surviving sheets.  Could you check if hitting the "Refresh" icon clears up the display the next time this happens?  Or if you're running a VBScript, just add the Report.Refresh() command at the end of that VBScript and see if the issue ever happens when running that script.

 

If the issue persists and is not addressed with refreshing the REPORT panel, then we'll need a data set, REPORT layout and any VBScript you're running, even if they don't show the issue every time.  We need something to reproduce the issue, which I haven't heard of before.  Even if it turns out to be a bug, hopefully we can suggest a workaround to your approach that will give you the display you want reliably, while R&D works on fixing the bug that your current approach runs into.

 

Brad Turpin

Senior Support Engineer

National Instruments

0 Kudos
Message 4 of 10
(5,905 Views)

All,

I think I've seen a similar behavior in DIAdem 2019 SP1, so wanted to mention it, but with a few specific details that may or may not be different.

 

We have a script that loads large layouts (~200 sheets, many with multiple 3D Contour plots per page), then rearranges/removes sheets depending on some logic within the script.

 

On *some* users' machines, running the script causes an issue where a sheet that was "deleted" is not correctly removed.

 

The deleted sheet's name will remain visible at the bottom of REPORT, but the displayed contents of the sheet will actually be from the next sheet over.  This makes users believe their sheets are somehow "offset" and actually causes the script to crash if you run something like this:

a=true

b=true

If a = True then

  If Report.Sheets.Exists("My Sheet") then Call Report.Sheets.Remove("My Sheet")

End if

If b = True then

  If Report.Sheets.Exists("My Sheet") then Call Report.Sheets.Remove("My Sheet")

End if

 

This is an oversimplified version of the logic (we are not purposefully trying to delete a sheet twice, but had the deletion in 2 separate logic statements that both happened to be true in one case).

 

Because of this error, REPORT returns that "My Sheet" still exists after it has been removed, but the second Remove call fails because the sheet doesn't actually exist, resulting in an entry such as this in the error log:

    Error:No worksheet called "My Sheet" exists.

 

It's almost like there's an internal list of sheets used for the bottom REPORT listing that is somehow getting out of sync with the actual REPORT contents?

 

Unfortunately, this appears to only happen reliably on some peoples' machines (2 users so far).  I saw it happen once or twice to myself under other circumstances, but so rarely that I never tried to document what led to it...

 

Thoughts?

-Josh

0 Kudos
Message 5 of 10
(5,713 Views)

All,

I've figure out how to reliably replicate the bug i'm talking about!

 

The layout just has manual name labels on the sheets so you can tell when the sheet name no longer matches the sheet contents.

 

The attached code and layout will cause each sheet after position 3 to display the previous sheet's information:

For example:

  • "Third Sheet" (ends in position 4)  will display information from the deleted "Second Sheet"
  • "Seventh Sheet" (ends in position 5) will display the information from "Third Sheet"
  • If you select "Fourth Sheet" (ends in the last position), it will crash DIAdem outright

 

This is in DIAdem 2019 SP1, and DIAdem 2020.

 

This only happens when REPORT is open while doing these rearrangements/deletions, as far as I can tell.  Our current workaround is to display the Navigator while doing this, and the issue appears to go away.

 

-Josh

Message 6 of 10
(5,676 Views)

All,

My example also breaks DIAdem 2020 SP1.

 

-Josh

Message 7 of 10
(5,600 Views)

Hi Josh,

 

I ran your script and layout in my DIAdem 2020 SP1 and completely reproduced every aspect of the bug that you mentioned.  I entered a full description and the 2 attached files in new Bug #1200337.  I'm glad you have such an easy workaround, but I'm curious if the underlying problem might cause worse issue for others trying to do something similar.  Hopefully R&D can figure this out.

 

Thanks for the post,

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 8 of 10
(5,342 Views)

Hey Josh,

 

I tried out the script in DIAdem 2021 that used to reproduce this sheet name/index issue in DIAdem 2019 and DIAdem 2020, and... it looks like DIAdem 2021 fixed it.  The problem does not occur in my DIAdem 2021 but still occurs for me in DIAdem 2019 and DIAdem 2020 SP1.

 

Can you confirm on your end?

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 9 of 10
(5,041 Views)

Yep, 2021 appears to have fixed it.

 

Thanks Brad (and Devs)!

 

-Josh

0 Kudos
Message 10 of 10
(4,979 Views)