I want a view of the struktur of an nested array as a string that i can show in the message box or a field .
Until jet I could get it solved and did not found a sample in the forum ...
If I over see a topic with a solution for this problem please just link it
For a array use combine I get the nice key value pairs for a second level I can iterate the combine for each element,
but if I dont know how many arrays are nested and how each is built I got errors or repeating the same lines ...
I would like to see it about this:
(this is no code just because otherwise it allways flaten my sample list)
Code: Select all
ArrayName (here the name of the custom property)
key1OfLevel1 = 4 (if it is not an array just show the value)
key2OfLevel1
key1OfLevel2
key2OfLevel2
key1OfLevel3
key2OfLevel3
key3OfLevel3
key3OfLevel2 = "Haus"
key4OfLevel2
key3OfLevel1
key1OfLevel2
key2OfLevel2
:
:
:
my code yet:
Code: Select all
function ArrayShowStruktur pBenutzerName
if pBenutzerName is empty then put "MyName" into pBenutzerName
put the pBenutzerName of this stack into dasArray
put " " into dieEzStufe
put dieEzStufe into derEinzug
if dasArray is an array then ## main 'if'
put pBenutzerName && " -> Anz. Elemente:" && the number of elements in dasArray & return into dieArrayStruktur
put ArrayShowSubStruktur ( dasArray, dieEzStufe, derEinzug ) & return after dieArrayStruktur
end if ## ENDE main 'if'
return dieArrayStruktur
end ArrayShowStruktur
## iterating across each nested array
#################################
function ArrayShowSubStruktur dasLoopArrayElement dieLoopEzStufe derLoopEinzug
put derLoopEinzug & dieLoopEzStufe into derLoopEinzug
if dasLoopArrayElement is an array then
repeat for each element diesesElement in dasLoopArrayElement
put derLoopEinzug & diesesElement && "-> Anz. Elemente:" && \
the number of elements in diesesElement & return after dieLoopArrayStruktur
put derLoopEinzug & dieLoopEzStufe & the keys of diesesElement & return after dieLoopArrayStruktur
put ArrayShowSubStruktur ( diesesElement, dieLoopEzStufe, derLoopEinzug ) & return after dieLoopArrayStruktur
end repeat
end if
return dieLoopArrayStruktur
end ArrayShowSubStruktur