• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Adams
  3. Is it possible to fetch a variable value which is referenced...

Following Cadence Design Systems’ acquisition of the Design & Engineering (D&E) business, the D&E Community Forum on the Nexus Community Center has been migrated in the Cadence Physical System Simulation Community. For more details and if you have any questions, please refer to the FAQ.

Stats

  • State Not Answered
  • Replies 3
  • Subscribers 3
  • Views 15
  • Members are here 0
More Content

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

darshan.v
darshan.v over 9 years ago
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
  • Sign in to reply
  • Cancel
  • Rishikesh Mokashi
    0 Rishikesh Mokashi over 9 years ago
    Hi Darshan,
     
    Something like this should work:
     
    variable set variable_name = variable_names string_value = "body_1", "body_2"
    variable set variable_name=myvar str=(eval(variable_names[1]))
     
    Which yields:
    Object Name : .MODEL_1.myvarObject Type : Variable
    String Value(s) : body_1
    Comment String : None
     
    Regards,
    Rishi
     
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • darshan.v
    0 darshan.v over 9 years ago
    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
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jesper Slattengren
    0 Jesper Slattengren over 9 years ago
    Why do you use string values instead of object types? Then you shouldn't have to use the STOO function.
    I figure something like $_self.part_name.object_value[1] should do the trick.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information