• 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. Accessing form fields names and values

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 11059
  • 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

Accessing form fields names and values

dragank
dragank over 4 years ago

Hi all.

Here is mentioned "oferSaveTemplate()".

I need to iterate through form fields and save "name=value" pairs in .txt file.

Here is mu current code:

procedure(
     saveTemplateButtonBoxAL()
  outputFolder = plotterForm->fileOutStringField->value
  outputFileName = plotterForm->fileNameStringField->value
  outputFile = strcat(outputFolder "/" outputFileName)
  out = outfile(strcat(outputFile) "w")
  foreach( field plotterForm->?
    if( and(field->name field->value)
      then
      lin = strcat(field->name "=" field->value)
      fprintf(out lin)
    )
  )
  close(out)
)

Is this achieved by:

        foreach(key '(userFilename userRadio)
            fprintf(fport "  %s %L\n" key get(oferUserDataForm key)->value)
            )

in mentioned post?

Thank you in advance.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    Yes. Also the block above that where it grabs some of the other fields from the main form (in the example code there are two forms, and the template saves the value from both).

    Your code is a bit strange:

    1. I would expect you to use foreach(field plotterForm->fieldList to iterate over the form. Even with what you're doing, it's grabbing the name of the slot, not the object itself.
    2. It's a bit odd doing the strcat and then fprintf
    3. There's no ->name attribute

    So something like this:

    foreach(field plotterForm->fieldList
      fieldData=get(plotterForm field)
      when(fieldData->value
        fprintf(out "%s=%L\n" field fieldData->value)
      )
    )

    should do the job.

    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