Anzahl der Items einer Arrayvariable ändern

Anzahl der Items einer Arrayvariable ändern

Hallo zusammen,
wir wollen durch einen Wizard die Anzahl der Items einer Arrayvariablen ändern.
Es scheint zu funktionieren wenn die Eigenschaft „Dim1“ geändert wird, weil die geänderte Arrayvariable im Editor mit der neuen Anzahl von Items angezeigt wird.
Es ist jedoch nicht so, weil:
- Beim „Selektierte XML Exportieren“ enthält die geänderte Arrayvariable die alte Anzahl von Items!
- Wenn durch VBA („Dim1“) die Anzahl von Items verkleinert wird und dann im Editor wieder vergrößert wird, enthalten die „neue“ Items die Werte (z. B. die Kennung) der Alte Items vor der Verkleinerung.
- Wenn beide Handlungen (Verkleinerung + Vergrößerung) im Editor gemacht werden, sind die neue Items total leer (z. B. die Kennung ist leer).
Es scheint nur zu funktionieren wenn die Aktion direkt im Editor gemacht wird.
In dem Code unten, wird die Anzahl von Items einer Arrayvariable von 5 zu 3 verkleinert. Nach der Ausführung hat die Variable im Editor 3 Items.
VBA Code:
Sub Test()
Dim zVar As Variable
Set zVar = MyWorkspace.ActiveDocument.Variables.Item("TestArray")

Debug.Print "Original - Dim1: " & zVar.DynProperties("Dim1")
zVar.DynProperties("Dim1") = 3
Debug.Print "Geändert - Dim1: " & zVar.DynProperties("Dim1")
End Sub

Im Direktbereich des VBA-Editors wird folgendes angezeigt:
Original - Dim1: 5
Geändert - Dim1: 3
Anbei die exportierte XML-Datei der Arrayvariable, die nach der Ausführung noch 5 Items enthält.
Bei mir läuft zenon 6.51 SP0 Build 10
Gibt es eine Lösung oder Umweg dafür?
Gruß
rln

This is a migrated post! Originally posted on 22.06.2012 by user rln. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com