hexagon logo

Is it possible to fetch a variable value which is referenced by other variable ?

Hi,
 
As per below code, I have created variables (body_1, body_2) using other variable's string values (body). Now I want to access "body_1" in my code but I suspect it is possible to access it.
 
_________________________________________________________
var set var = $_self.part_name string = &
"body", &
"subframe", &
"upright"
!
var set var = (eval("$_self."//($_self.part_name[1]))) string = &
"body_1", &
"body_2", &
!
var set var = (eval("$_self."//($_self.part_name[2]))) string = &
"subframe_1", &
"subframe_2", &
!
var set var = (eval("$_self."//($_self.part_name[3]))) string = &
"upright_1", &
"upright_2", &
!
acar too mess mess=(eval($_self.part_name[1].string_value[1]))
!
_____________________________________________________________________
 
Regards,
Darshan M. Vachhani
AF Consult, Sweden
Parents
  • Hi Rishi,
     
    Thank you for the reply.
     
    Actually I want to access values of variables which is created by other variable names.
    In my example code, I want to access "body_1" through the variable "$_self.part_name" which I have created in the beginning.
     
    BTW, I got the resolution as below. May be not proper but it works for me.
     
    acar too mess mess=(eval(STOO("$_self."//($_self.part_name[1])).string_value[1]))
    acar too mess mess=(eval(STOO("$_self."//($_self.part_name[1])).string_value[2]))
     
    This gives output as,
    body_1
    bosy_2
     
    Thank you.
     
    Regards,
    Darshan M. Vachhani
    AF Consult, Sweden
Reply
  • Hi Rishi,
     
    Thank you for the reply.
     
    Actually I want to access values of variables which is created by other variable names.
    In my example code, I want to access "body_1" through the variable "$_self.part_name" which I have created in the beginning.
     
    BTW, I got the resolution as below. May be not proper but it works for me.
     
    acar too mess mess=(eval(STOO("$_self."//($_self.part_name[1])).string_value[1]))
    acar too mess mess=(eval(STOO("$_self."//($_self.part_name[1])).string_value[2]))
     
    This gives output as,
    body_1
    bosy_2
     
    Thank you.
     
    Regards,
    Darshan M. Vachhani
    AF Consult, Sweden
Children
No Data