Uniface Structs: hurdle 2
Author: gianni.sandigliano@unifacesolutions.com (gianni)
Hi Unifacers, In a struct member names can have repetitions on same level so the only way to refer for sure to a specific member on a certain level is by its $index. Extending this concept through levels the only unique identification of each struct member in a struct it is through its "path of $index(es)" starting from the root of the struct...something like: putmess vStruct->*{1}->*{3}->*{2}->whatever This instruction is a complex and fixed one: it refers to a specific number of levels. Uniface variables can be used instead of hardcoded positional numbers like in: putmess vStruct->*{vPosLevel1}->*{vPosLevel2}->*{vPosLevel3}->whatever on each level but number of tree levels are 'de facto' hardcoded into code. It is unclear to me: is it possible to refer to a specific member of a struct using a single Uniface variable or (better) a single Uniface list, whatever is the number of levels? Something like: putmess vStruct->UnifaceList->whatever where UnifaceList could be: "1Gold;3Gold;2" or "1=*Gold;3=*Gold;2=*". I've looked into documentation and digged many examples without finding any hint. Levels can only be hardcoded? An example from the field: I need to search a specific name (tag) in my struct but this name could be positioned on level 3 or 4 depending from how the original XML was generated. Trying to implement a generic search into a struct I would like to pass the member name I am looking for and have it back a reference to first instance of that name in the struct, travelling the struct in one of the two possible ways: - sequentially: from top to bottom or backward - by levels: all level 1 then all level 2 ecc. or backward (this should be probably better in my current case) Let's imagine I give back a Uniface list like the one I've mentioned before ("1Gold;3Gold;2"); how could be used to reach and manipulate the required member through its "path of $index(es)"? Thanks in advance for any answer / suggestion / hint. Gianni