• 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. Form fields as variable

Stats

  • Replies 4
  • Subscribers 144
  • Views 348
  • Members are here 0

Form fields as variable

AE202502048334
AE202502048334 8 days ago

Hi all I want to create a form that has variable "?fields" list, I create this list with other functions but I can't insert this list inside my form fields as shown here:

boolean1 = hiCreateRadioField(

                         ?name 'boolean1

                         ?choices list("Y" "N")

                         ?prompt "boolean1"

                         ?defValue ""

                    )

boolean2 = hiCreateRadioField(

                         ?name 'boolean2

                         ?choices list("Y" "N")

                         ?prompt "boolean2"

                         ?defValue ""

                    )


booleanList = list(

                      list( boolean1 5:0 120:20 200)

                      list( boolean2 5:30 120:20 200)            

)

form = hiCreateAppForm(

             ?name 'form

             ?minSize list(1000 100)

             ?formTitle "form"

             ?fields booleanList

)

hiDisplayForm(form)

This code is of course simplified to the point I want to ask about, this gives me the following error:

unbound variable - unbound

  • Cancel
  • Sign in to reply
Parents
  • Aurel B
    Aurel B 8 days ago

    You are probably loading something else, as this code seems valid and did run in my Virtuoso session.

    I know this is an example for the forum, but you should avoid using names that are too short as they will probably overlap with protected names.

    For instance, you are not allowed to name a field using 'name symbol!

    (Using _ is a safe solution : 'name_field instead of 'name should always work for instance.)

    Also, you should have a look at layout forms that are easier to maintain than hardcoded coordinates.

    In your case, you can replace the code with something like : 

    boolean1 = hiCreateRadioField(
    ?name 'boolean1
    ?choices list("Y" "N")
    ?prompt "boolean1"
    ?defValue ""
    )

    boolean2 = hiCreateRadioField(
    ?name 'boolean2
    ?choices list("Y" "N")
    ?prompt "boolean2"
    ?defValue ""
    )

    main_layout = hiCreateFormLayout( 'main_layout ?items list( boolean1 boolean2 ) )

    form = hiCreateLayoutForm( 'form "form" main_layout ?minSize list(1000 100) )

    hiDisplayForm(form)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • AE202502048334
    AE202502048334 7 days ago in reply to Aurel B

    Hi Aurel, thank you for taking the time to answer, but you didn't run the same code snippet I gave in my case, I already stored boolean1 & boolean2 in another variable which is booleanList, then added this variable in the fields of the form. this will give an error.

    but let me explain why I'm doing this:
    the items I want to add to the form is not static, it will be a list created by another function so this list will be stored in a variable (booleanList) , so I can't use the method u are using here of just adding boolean1 & boolean2 inside the form, I will be having something like 30 boolean  field or more.
    so I need a way to iterate over a list of booleans and add them to the form

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • AE202502048334
    AE202502048334 7 days ago in reply to Aurel B

    Hi Aurel, thank you for taking the time to answer, but you didn't run the same code snippet I gave in my case, I already stored boolean1 & boolean2 in another variable which is booleanList, then added this variable in the fields of the form. this will give an error.

    but let me explain why I'm doing this:
    the items I want to add to the form is not static, it will be a list created by another function so this list will be stored in a variable (booleanList) , so I can't use the method u are using here of just adding boolean1 & boolean2 inside the form, I will be having something like 30 boolean  field or more.
    so I need a way to iterate over a list of booleans and add them to the form

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Aurel B
    Aurel B 7 days ago in reply to AE202502048334
    AE202502048334 said:
    Hi Aurel, thank you for taking the time to answer, but you didn't run the same code snippet I gave in my case, I already stored boolean1 & boolean2 in another variable which is booleanList, then added this variable in the fields of the form. this will give an error.

    I literally copy-pasted your snippet into the CIW and it worked...

    AE202502048334 said:
    the items I want to add to the form is not static, it will be a list created by another function so this list will be stored in a variable (booleanList) , so I can't use the method u are using here of just adding boolean1 & boolean2 inside the form, I will be having something like 30 boolean  field or more.
    so I need a way to iterate over a list of booleans and add them to the form

    This is one more reason why you should use dynamic layout forms!

    Here is a small example:

    main_layout = hiCreateFormLayout( 'main_layout ?items () )
    form = hiCreateLayoutForm( 'form "form" main_layout ?minSize list(1000 100) )
    
    ;; Dynamically add fields to the form layout.
    for( i 0 9
      hiAddField( form->main_layout
        hiCreateRadioField(
          ?name     (concat 'boolean i)
          ?choices  list("Y" "N")
          ?prompt   (lsprintf "boolean%d" i)
          ))
      0
    
    hiDisplayForm(form)
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • AE202502048334
    AE202502048334 7 days ago in reply to Aurel B

    Hi Aurel, 
    Thank you so much for your answer, it worked for me!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel

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.

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

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