• 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. hiCreateCyclicField : Value changes when the choices are...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 142
  • Views 3054
  • 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

hiCreateCyclicField : Value changes when the choices are updated

kkdesbois
kkdesbois 11 months ago

Hello,
When I update the list of choices of a cyclic, the selected value is updated to the first value of the nex choices list, even if the selected value is still part of the new choices list.

Is there a way to avoid that?

Code example :

trCyclicList = '("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
trCyclicField = hiCreateCyclicField(?name 'trCyclicField ?prompt "Cycle Through: " ?choices trCyclicList ?value "3" ?defValue "7" ?callback "println" )
hiCreateAppForm( ?name 'trSampleForm2 ?formTitle "Sample Form" ?callback "println( 'FormAction )" ?fields list(trCyclicField) ?unmapAfterCB t )
hiDisplayForm(trSampleForm2)

If I modify the choices list from the CIW : 
trSampleForm2->trCyclicField->choices='("1" "2" "3" "4" "5" "6" "7")

Laurent

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett 11 months ago

    Laurent,

    I can't find any requests or default mean to change this behaviour, but if you do:

    let(((curVal trSampleForm2->trCyclicField->value)) trSampleForm2->trCyclicField->choices='("1" "2" "3" "4" "5" "6" "7") trSampleForm2->trCyclicField->value=curVal)

    then it will preserve the current value. You could always make it a bit safer (to avoid a warning if the current value didn't exist):

    let(((curVal trSampleForm2->trCyclicField->value)) trSampleForm2->trCyclicField->choices='("1" "2" "3" "4" "5" "6" "7")
      when(member(curVal trSampleForm2->trCyclicField->choices)
        trSampleForm2->trCyclicField->value=curVal
      )
    )

    Of course, you could wrap this up in a convenient function to change an selectively preserve current values on choice changes.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett 11 months ago

    Laurent,

    I can't find any requests or default mean to change this behaviour, but if you do:

    let(((curVal trSampleForm2->trCyclicField->value)) trSampleForm2->trCyclicField->choices='("1" "2" "3" "4" "5" "6" "7") trSampleForm2->trCyclicField->value=curVal)

    then it will preserve the current value. You could always make it a bit safer (to avoid a warning if the current value didn't exist):

    let(((curVal trSampleForm2->trCyclicField->value)) trSampleForm2->trCyclicField->choices='("1" "2" "3" "4" "5" "6" "7")
      when(member(curVal trSampleForm2->trCyclicField->choices)
        trSampleForm2->trCyclicField->value=curVal
      )
    )

    Of course, you could wrap this up in a convenient function to change an selectively preserve current values on choice changes.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • kkdesbois
    kkdesbois 11 months ago in reply to Andrew Beckett

    Thanks Andrew.
    So It's the normal behavior.

    I will hence pass in a memorization step before updating the choices list as you suggest.

    Laurent.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 11 months ago in reply to kkdesbois

    Laurent,

    I wasn't sure on the expected behaviour, so I checked in IC5.1.41 too (in a release from 13 years ago) and the behaviour was the same there.

    Andrew

    • 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