get_valid_values(...) - get_valid_values(...) - 2026.1 English - UG1781

Python Scripting Guide for PDM Tool (UG1781)

Document_ID
UG1781
Release_Date
2026-06-23
Version
2026.1 English
Revision

Description

Get dictionary of specified record names mapped to dictionaries of specified writable field names to list/range of valid value mappings, if valid values vary across records and all_records is True, otherwise, a dictionary of specified writable field names to list/range of valid value mappings for the resource. Read-only fields are excluded even if specified.

Syntax

get_valid_values([<field_names>], [<record_names>], all_records=False)

Returns

Dictionary in a format {record: {field: [valid_value, ...], ...}, ...}, if all_records is True or {field: [valid_value, ...], ...}, otherwise.

Parameters

Name Description
[<field_names>] List of field names.

Default: All fields

[<record_names>] List of record names. If specified, the all_records flag is ignored and only records in the list are considered.

Default: Depends on the value of all_records.

[all_records] Enables returning valid values of each record if True, considering that valid values can vary for the same field across different records, otherwise, only the resource uniform valid values.

Default: False

Examples

# Get valid values for all writable fields of a resource
proj = open_project('my_design.pdm')
io_config = proj.get_block('io').get_resource('io_config')
valid = io_config.get_valid_values()
# valid == {'io_type': ['XP', 'HD', 'HDIO'], 'data_rate': ['SDR', 'DDR'], ...}
# Get valid values for specific fields only
valid = io_config.get_valid_values(['io_type', 'data_rate'])
# Get valid values per record (may differ from resource-level valid values)
all_valid = io_config.get_valid_values(all_records=True)
# all_valid == {'io_inst1': {'io_type': ['XP', 'HD', 'HDIO'], ...}, ...}