• 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. Custom IC SKILL
  3. How can a concatenated string be transformed into a variable...

Stats

  • Replies 6
  • Subscribers 151
  • Views 78
  • Members are here 0

How can a concatenated string be transformed into a variable name?

SZ20260803361
SZ20260803361 23 hours ago

I want to set a variable name that can change over time. For example:
item=""
lists=setof(i parseString(getCurrentTime() "") i!) =" "&&i! =":")
foreach(elem lists

item=strcat(item elem)
)
I received the item with the code "Aug201706212026".
I want to replace the "item" in the variable name "a_item" with "Aug201706212026", so that the final variable name becomes "a_Aug201706212026". How can I do this? I tried using `setq(stringToSymbol(strcat("a_" item)) 5)`, but this caused an error. How should I proceed?

  • Sign in to reply
  • Cancel

Top Replies

  • Andrew Beckett
    Andrew Beckett 20 hours ago +1
    This is almost certainly not what you want to do, because creating different variable names on the fly usually means you should be creating a different data structure - e.g. a hash table indexed by the…
Parents
  • Andrew Beckett
    Andrew Beckett 20 hours ago

    This is almost certainly not what you want to do, because creating different variable names on the fly usually means you should be creating a different data structure - e.g. a hash table indexed by the date rather than a unique variable name. However, if you really want to do this (the wrong way in my opinion), then taking your code:

    item=""
    lists=setof(i parseString(getCurrentTime() "") i!=" " && i!=":")
    foreach(elem lists
        item=strcat(item elem)
    )

    (I assume you used some kind of optical character recognition because it had some spurious parentheses) then you could do:

    set(concat("a_" item) 5)

    you can retrieve it with:

    symeval(concat("a_" item))

    A cleaner (more efficient in terms of creating garbage that needs collecting) way of building the variable name would be to do:

    cleanup=pcreCompile("[ :]")
    varName=concat("a_" pcreReplace(cleanup getCurrentTime() "" 0))

    However, if you creating a number of these, I'd use a hash table (using makeTable) as I mentioned before.

    Regards,

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • SZ20260803361
    SZ20260803361 3 hours ago in reply to Andrew Beckett

    This project is developed to meet requirements from the layout team. They need a persistently‑pinned UI panel that can be activated by clicks at any time. For this purpose, I planned to use dockWindow so that the panel can be docked inside the PTE frame. However, I have run into multiple issues during development, as listed below:

    1. With my current implementation, the dock window is only created for a single session window. My expectation is to make this dock window available for multiple session windows simultaneously.
    2. How can I completely delete an appForm from memory? I create an appForm via hiCreateLayoutForm, then construct the dock window with:

    dock_W = hiCreateDockWindow(
                           ?appType "layout"
                           ?widgetType "form"
                           ?form appForm )

    Afterwards I render the dock window with:

    foreach( n ns hiDockWindow( ?window dock_W ?session n ) )

    My intention is to automatically unset the global variable appForm after the dock window is generated. When creating the dock window for another session window, I would recreate the global appForm variable.

    1. If fully destroying appForm is not feasible, I considered generating time‑dependent unique variable names. Each time a new session window opens, a brand‑new global variable such as appForm_currentTime would be generated to avoid naming conflicts caused by re‑using the same variable appForm.

    This is the motivation behind my post.

    There are three global variables in my codebase: appForm, layoutForm_pte and dock_W.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • SZ20260803361
    SZ20260803361 3 hours ago in reply to Andrew Beckett

    This project is developed to meet requirements from the layout team. They need a persistently‑pinned UI panel that can be activated by clicks at any time. For this purpose, I planned to use dockWindow so that the panel can be docked inside the PTE frame. However, I have run into multiple issues during development, as listed below:

    1. With my current implementation, the dock window is only created for a single session window. My expectation is to make this dock window available for multiple session windows simultaneously.
    2. How can I completely delete an appForm from memory? I create an appForm via hiCreateLayoutForm, then construct the dock window with:

    dock_W = hiCreateDockWindow(
                           ?appType "layout"
                           ?widgetType "form"
                           ?form appForm )

    Afterwards I render the dock window with:

    foreach( n ns hiDockWindow( ?window dock_W ?session n ) )

    My intention is to automatically unset the global variable appForm after the dock window is generated. When creating the dock window for another session window, I would recreate the global appForm variable.

    1. If fully destroying appForm is not feasible, I considered generating time‑dependent unique variable names. Each time a new session window opens, a brand‑new global variable such as appForm_currentTime would be generated to avoid naming conflicts caused by re‑using the same variable appForm.

    This is the motivation behind my post.

    There are three global variables in my codebase: appForm, layoutForm_pte and dock_W.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data

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