Skip to main content

Hi Unifacers,

I am using Uniface Lists a lot either in the basic as well as the associative format. So far so good!

But what about structs and Uniface list?

We can put into our proc script code:

1) Constants.
Example:
$myStruct$->Level1->Level2{2}->Level3->$scalar
2) A single variable for each level.
Example:
vVar1 = "Level1"
vVar2 = "Level2{2}"
vVar3 = "Level3"
$myStruct$->"%%vVar1%%%"->"%%vVar2%%%"->"%%vVar3%%%"->$scalar

Do you feel the need to use a list containing the struct path to point to?
Example:
vList = ""
putitem vList, 1, "Level1"
putitem vList, 2, "Level2{2}"
putitem vList, 3, "Level3"
$myStruct$->"%%vList%%%"->$scalar

If this last syntax will be supported some of my routines will become a lot shorter and probably much faster.

I would like to know what other Uniface users feel about it.

Regards,
Gianni

Hi Unifacers,

I am using Uniface Lists a lot either in the basic as well as the associative format. So far so good!

But what about structs and Uniface list?

We can put into our proc script code:

1) Constants.
Example:
$myStruct$->Level1->Level2{2}->Level3->$scalar
2) A single variable for each level.
Example:
vVar1 = "Level1"
vVar2 = "Level2{2}"
vVar3 = "Level3"
$myStruct$->"%%vVar1%%%"->"%%vVar2%%%"->"%%vVar3%%%"->$scalar

Do you feel the need to use a list containing the struct path to point to?
Example:
vList = ""
putitem vList, 1, "Level1"
putitem vList, 2, "Level2{2}"
putitem vList, 3, "Level3"
$myStruct$->"%%vList%%%"->$scalar

If this last syntax will be supported some of my routines will become a lot shorter and probably much faster.

I would like to know what other Uniface users feel about it.

Regards,
Gianni

I'd have thought you could build a simple global proc to do this. 

gp_list_struct($mystruct$, vList)→$scalar 

or

v_test_struct=gp_list_struct($mystruct$, vList)

v_test_struct->$scalar



WHere gp_list_struct is something like 

params
	struct p_instruct : IN
	string p_List : IN
endparams
returns struct
variables
	struct v_struct
	string v_index
endvariables

v_struct = p_instruct
forlist v_index in p_List
	v_struct = v_struct->"%%v_index%%%"
endfor
return v_struct
end


regards, 

Iain


Hi Unifacers,

I am using Uniface Lists a lot either in the basic as well as the associative format. So far so good!

But what about structs and Uniface list?

We can put into our proc script code:

1) Constants.
Example:
$myStruct$->Level1->Level2{2}->Level3->$scalar
2) A single variable for each level.
Example:
vVar1 = "Level1"
vVar2 = "Level2{2}"
vVar3 = "Level3"
$myStruct$->"%%vVar1%%%"->"%%vVar2%%%"->"%%vVar3%%%"->$scalar

Do you feel the need to use a list containing the struct path to point to?
Example:
vList = ""
putitem vList, 1, "Level1"
putitem vList, 2, "Level2{2}"
putitem vList, 3, "Level3"
$myStruct$->"%%vList%%%"->$scalar

If this last syntax will be supported some of my routines will become a lot shorter and probably much faster.

I would like to know what other Uniface users feel about it.

Regards,
Gianni

Hi Iain,

that's was exactly my first tought...it's not too complex, let's code!

But then going further you need to extend the initial routine to:
- support all struct function available ($scalar, $name, $parent, ...)
- support all possible actions on struct item you are pointing to (insert, update, delete, add at collection end)
- support automatic full path creation

The missing feature in almost all cases is dynamic struct path support: that's why I've decided to ask if there could be interest in such improvement.

Regards,
Gianni