• 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. Using for loop inside hiCreateAppForm fields

Stats

  • Locked Locked
  • Replies 10
  • Subscribers 143
  • Views 15904
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using for loop inside hiCreateAppForm fields

Sandeep4386
Sandeep4386 over 12 years ago
Hi,
I am encountering an error while using a for loop inside hiCreateAppForm fields. Here is the error message:
*Error* hiCreateAppForm: not all fields have 2D attributes specified, and/or illegal attribute values 
 
However if I comment out the for loop then error goes away. 
 
hiCreateAppForm(
?name 'Form
?formTitle "test form"
?fields
list(
      
       list(label 0:0 600:30 200)
list(all 10:30 600:30 20)
list(none 10:60 600:30 20)
list(cellviewFrame 0:90 600:30 200)
for(i 1 count 
  list(cellview[i] 10:90+(i*30) 600:30 20)
);for  
      );list
);hi createAppForm
       
hiDisplayForm(Form)
 
Any help would be appreciated.
P.S. cellview has been declared as an arry in earlier part of the code (declare(cellview[2]) ) 
 
Regards,
Sandeep 
  • Cancel
  • skillUser
    skillUser over 12 years ago

    Hi Sandeep,

    The issue is that for just returns t. I think that you may want something more like foreach mapcar (this is assuming that "cellview" contains a field that hiCreateAppForm can use), in combination with linRg to create a list of numbers to iterate over:

    
    hiCreateAppForm(
       ?name 'Form
       ?formTitle "test form"
       ?fields
         list(	
           list(label 0:0 600:30 200)
           list(all 10:30 600:30 20)
           list(none 10:60 600:30 20)
           list(cellviewFrame 0:90 600:30 200)
           foreach(mapcar i linRg(1 count 1)
             list(cellview[i] 10:90+(i*30) 600:30 20)
           );foreach mapcar  
         );list	
    );hiCreateAppForm
           
    hiDisplayForm(Form)
    

     

    Hopefully this willsolve the problem.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 12 years ago

    Hi Lawrence,

    Thank you for your response. I tried using foreach along linRg but it still gives out the same error. Plus, you are right, "cellview" does contain fields that can be used by hiCreateAppForm

     

    Regards,

    Sandeep 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Sandeep,

    The code as Lawrence posted it won't work because it would not be a correctly structured list - for a 2D form you need a list of sublists, and what you would have got is a list of sublists for the first four fields, and then a sublist containing sublists for each cellView.

    So you'd need something like this:

    hiCreateAppForm(
       ?name 'Form
       ?formTitle "test form"
       ?fields
         append(
    list( list(label 0:0 600:30 200) list(all 10:30 600:30 20) list(none 10:60 600:30 20) list(cellviewFrame 0:90 600:30 200)
    ) foreach(mapcar i linRg(1 count 1) list(cellview[i] 10:90+(i*30) 600:30 20) );foreach mapcar );append );hiCreateAppForm

     

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 12 years ago

    Thanks Andrew, that worked perfectly. One more question, I was trying one more alternative but that din't work, would you be able to tell what's wrong with method below:

    ButtonList=append1(ButtonList cellview[count])

    hiCreateAppForm(

           ?name 'Form

          ?formTitle "test form"

         ?fields append(

                           list(

                               list(label 0:0 600:30 200)

                               list(all 10:20 600:30 20)

       list(none 10:40 600:30 20)

                               list(cellviewFrame 0:70 600:40+(count*30) 200)

                             );list

                            ButtonList

                   );append

    );hi createAppForm

     

    Regards,

    Sandeep

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Sandeep,

    Probably because ButtonList is just a list of the fields, not a list of lists (where each sublist is the field plus coordinate info). The ?fields argument can either be a simple list of fields, or a list of the 2D attributes, but you can't mix the two together, which is what you're doing here.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 12 years ago
    Thanks Andrew, That makes sense.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 12 years ago
    Now I'm running with one more problem. I want to pass my array/table to different function and then access its fields, How do I do that? This is what I tried but din't work.


    procedure(allCB(cellview count)
       let((Form)
        Form=hiGetCurrentForm()
    foreach( key cellview
                 Form->cellview[key]->value=t
        ;a=getq( get(checkNsaveForm arrayref(cellview key)) value) ;Form->cellview[key]->value=t
        ;println(a)
    )
       );let
    );procedure
     
    This errors out with the message: *Error* arrayref: can't handle nil[1]
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 12 years ago

    Hi Sandeep,

    Apologies for the earlier mistake, I did not test the code...  For this latest, you will most likely need to use get again and putprop/putpropq, something like the following (again, not tested, so apologies if it still fails):

    
    procedure(allCB(cellview count)
      let((Form)
       	Form=hiGetCurrentForm()
        foreach( key cellview
           putpropq(get(Form cellview[key]) t value)
        ;a=getq( get(checkNsaveForm arrayref(cellview key)) value) ;Form->cellview[key]->value=t
        ;println(a)
        )
      );let
    );procedure

    Hope this works for you,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    If I've understood your previous examples, the cellview array contains the field structures, not the field names. In which case you'd do:

    get(Form cellview[key]->hiFieldSym)->value=t

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 12 years ago

    Thanks Lawrence and Andrew.

    get(Form cellview[key]->hiFieldSym)->value=t  worked perfectly.

    I will keep posting here in case of further problems. appreciate your help.

     

    Regards,

    Sandeep 

     

    • Cancel
    • Vote Up 0 Vote Down
    • 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