• 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. Creating a string field for a choice inside a cyclic fi...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 17130
  • 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

Creating a string field for a choice inside a cyclic field

Vishu21
Vishu21 over 6 years ago

Hi,

I have created a Cyclic Field for my form as follows:

hiCreateCyclicField(?name C1 ?choices '("Interdigitation" "Common Centroid") ?prompt "Matching")

Now what I want is that if a user selects Common Centroid then an additional string filed must be added to the existing form which asks user to give a specific input,and if user selects Interdigitation then no field is to be added!

How can I achieve this functionality???

Please help!

T&R

Vishal

  • Cancel
Parents
  • berndfi
    berndfi over 6 years ago

    Hi,

    I would solve this a bit different.

    I would add that additional filed permanently, but make it non-editable per default.

    With a field callback on your filed which contains “interdigitated” I would switch it to edit mode if only interdigitated is chosen and switch it back to non-editable for the other choices.

    Bernd

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • berndfi
    berndfi over 6 years ago

    Hi,

    I would solve this a bit different.

    I would add that additional filed permanently, but make it non-editable per default.

    With a field callback on your filed which contains “interdigitated” I would switch it to edit mode if only interdigitated is chosen and switch it back to non-editable for the other choices.

    Bernd

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • skillUser
    skillUser over 6 years ago in reply to berndfi

    Or as a variation on what Bernd is suggesting, add the field but toggle its visibility setting based on the state of the cyclic field, changed by a callback on that field.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Vishu21
    Vishu21 over 6 years ago in reply to skillUser

    Hi,

    I have now defined my Cyclic field as follows:

    hiCreateCyclicField (?name C1 ?choices '("Interdigitation" "Common Centroid") ?prompt "Matching" ?callback if(form->C1->value == "Common Centroid" then f6 = hicreateStringField (?name 'S4 ?prompt "Second Row" ? editable t) else hicreateStringField (?name 'S4 ?prompt "Second Row" ?editable nil)))

    But this is not working !!! The field is always uneditable regardless of Common Centroid or Interdigitation

    Thanks,

    Vishal.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to Vishu21

    Not really surprising that this doesn't work - there are numerous things wrong with this:

    1. The callback isn't in quotes so would execute immediately, not at the time the cyclic field is changed
    2. The callback expression is just creating a new field in a variable f6 - unless it does something with that new field, it's not going to impact any existing field on the form. Replacing the field in a variable doesn't update the field on the form. You almost certainly don't want to create a new field anyway, just changed the editable status of the existing field.
    3. There are spaces after the function names
    4. hiCreateStringField has an uppercase "C"
    5. The ?name for hiCreateCyclicField should be quoted

    It's far better if you post the actual code rather than something similar to it that you've re-typed in (I assume it really wasn't quite as bad as above) as otherwise everyone wastes time trying to correct mistakes that you've presumably not actually made.

    Anyway, here's some code that works, with some skeleton code around it so that I could test it (even though I knew it would be OK, I always like to test things before posting if I can):

    let((f1 f6)
    f1=hiCreateCyclicField(
      ?name 'C1 
      ?choices '("Interdigitation" "Common Centroid") 
      ?prompt "Matching" 
      ?callback "hiSetFieldEditable(hiGetCurrentForm()->S4 if(hiGetCurrentForm()->C1->value==\"Common Centroid\" then t else nil))"
    )
      
    f6=hiCreateStringField(
      ?name 'S4
      ?prompt "Second Row"
      ?editable nil
    )
    
    hiCreateAppForm(
      ?name 'MyForm
      ?fields list(f1 f6)
      ?formTitle "forum example"
    )
    
    hiDisplayForm(MyForm)
    )

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Vishu21
    Vishu21 over 6 years ago in reply to Andrew Beckett

    Hi Andrew,

    I agree that i should've double checked the post for any errors before posting!! 

    The code has been correctly written in my script(there are no spaces after function names and "C" is in caps only).

    The callback statement was initially in quotes but it threw an error saying if statement has too many arguments so i removed the quotes.

    I am very new to creating forms in skill so I was just playing around different methods,I couldn't find anyone working so I posted the query 

    The actual code is wat too big and not actually required for this query(it's more of a general query)

    Thank you for providing the code snippet,I will now try it and will let you know if it worked!!

    Thanks,

    Vishal.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Vishu21
    Vishu21 over 6 years ago in reply to Andrew Beckett

    Hi Andrew,

    The method is working fine but the status of the filed is changing only once.

    When I am selecting Common Centroid then the field is becoming editable which is fine but once I am changing it back to Interdigitation it's still editable (it should become uneditable)

    Thanks,

    Vishal.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to Vishu21

    Presumably you're not using the code I posted, because this works fine. I'm guessing you've changed it in some way. Did you try the code I posted as-is?

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Vishu21
    Vishu21 over 6 years ago in reply to Andrew Beckett

    Hi Andrew, 

    Ya I cross-checked and found a mistake.

    Everything is working fine now.

    Thanks to everyone who replied.

    Regards,

    Vishal.

    • 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