07-13-2020 06:27 AM
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
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
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
07-13-2020 06:36 AM
And this errors looks strange aswell. in D2017 with no even warning and here errors.
I will try resave the report template in D2020...
07-13-2020 07:16 AM
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.
07-13-2020 12:20 PM
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.
07-14-2020 04:31 AM - edited 07-14-2020 04:34 AM
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"
07-14-2020 04:37 AM
07-14-2020 05:02 AM
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
07-29-2020 05:45 AM
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