DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

D2020 - Report deleting specified objects delete another objects with it

Hi,

i got a big script program which works fine in D2017. Im testing it in D2020, and when drawing report, script makes 2 calls to delete specified text and arrow type objects, but it seems it seems it deleted the axis object as well. 

Im debugging it, and really i delete 2 objects and it takes more objects, as im testing, it looks like a bug to me, but i would like to ask if u experience same behaviour?

I dont know how to simulate it, so i put screens to show it

 

This is how it should look in D2017 and the program had draw it well here

d2017.png

 

With this code, im deleting the template objects Line + Title

aObjectsNames = Array("TextLegendLine_Compare", "TextLegendTitle_Compare")
		For Each sObjectName In aObjectsNames
			If oObjects.Exists(oAxis.Name & "_" & sObjectName) Then Call oObjects.Remove(oAxis.Name & "_" & sObjectName)
		Next

This is how D2020 draws it

d2020.png

 

I tried to comment the delete command, and keep the objects, but to just change the text to "" for it to not be visible, but the result D2020 gave me is strange in different way, it didnt delete the axis object, but it crashed it somehow, that i dont see the axis descriptions and numbers.

Can you advice me please how to fix this? 🙂

 

This is after just emptting the text of the objects:

aObjectsNames = Array("TextLegendLine_Compare", "TextLegendTitle_Compare")
		For Each sObjectName In aObjectsNames
			If oObjects(oAxis.Name & "_" & sObjectName).ObjectType = 5 Then oObjects(oAxis.Name & "_" & sObjectName).Text = ""
			If oObjects(oAxis.Name & "_" & sObjectName).ObjectType = 9 Then oObjects(oAxis.Name & "_" & sObjectName).Line.Color.Transparency = 100
'			If oObjects.Exists(oAxis.Name & "_" & sObjectName) Then Call oObjects.Remove(oAxis.Name & "_" & sObjectName)
		Next

d2020EmptyText.png

0 Kudos
Message 1 of 8
(1,504 Views)

And this errors looks strange aswell. in D2017 with no even warning and here errors.

I will try resave the report template in D2020...

 

logfile.png

0 Kudos
Message 2 of 8
(1,499 Views)

And additional imporant info.

 

Program draws all sheets properly, but at the end, it focus on "Sheet 1" and i got an event OnReportRefresh, where i call to delete the objects.

So maybe its the bug in these events, cause i repeat myself that in D2017 it works just fine.

0 Kudos
Message 3 of 8
(1,490 Views)

I have set an event onReportRefresh, where the script checks all curves in 2DAxis, and on right i got a legend made from text and arrow object.

I got the event because when user manually delete some curves or add new curves to the axis, then refresh the report, the script create a new legend on the right, based on what curves are in there (its ignoring some curves like limits...)

 

and this event is deleting me all objects instead of just the legend objects.

0 Kudos
Message 4 of 8
(1,466 Views)

I debugged it and ended on command when i change the name of freetext object. Can someone please test it?

I add an attachement of a TDR file, where i have axis and legend. 

1) load the template

2) run this script:

 

 

Set oSheet = report.ActiveSheet
If oSheet.Objects.Exists("2DAxis1_TextLegendTitle_1") 	Then oSheet.Objects("2DAxis1_TextLegendTitle_1").Name = "2DAxis1_TextLegendTitle_Compare"

 

 

 

before.png

after.png

 

 

 

0 Kudos
Message 5 of 8
(1,445 Views)

it looks like a bug to me, but please tell me that im doing something wrong .)

0 Kudos
Message 6 of 8
(1,442 Views)

Another info. It happens as well if you do it manually.

Open the template TDR file i attached in zip and right click the legend text object on the right, choose "rename" a change it to something. This affect the 2DAxis object as well. but it should just change the name. 

this is really weird

0 Kudos
Message 7 of 8
(1,438 Views)

Hi Lukas_Doubek,

 

I have tested the behaviour in DIAdem 2020. It looks good to me - or I did something wrong. I have extended the script to create a log file:

 

dim oSheet, oAllObj, oObj

Set oAllObj = report.ActiveSheet.Objects

LogfileDel

for each oObj in oAllObj
  LogfileWrite oObj.Name
next

LogfileWrite "."

Set oSheet = report.ActiveSheet
If oSheet.Objects.Exists("2DAxis1_TextLegendTitle_1") 	Then oSheet.Objects("2DAxis1_TextLegendTitle_1").Name = "2DAxis1_TextLegendTitle_Compare"

for each oObj in oAllObj
  LogfileWrite oObj.Name
next

This is the result

 

MasterLayoutDescription
paging
results_range_1
2DAxis1
txtISO
TemplateSledTest
2DAxis1_TextLegendLine_1
2DAxis1_TextLegendTitle_1
.
MasterLayoutDescription
paging
results_range_1
2DAxis1
txtISO
TemplateSledTest
2DAxis1_TextLegendLine_1
2DAxis1_TextLegendTitle_Compare

 

... and an error message that says that the event "ReportOnRefreshEvent" could not be found - which is OK.

 

By the way, the black rectangles I don't see in the layout.

 

Greetings

Walter

 

0 Kudos
Message 8 of 8
(1,390 Views)