Skip to main content

ListContingentValues

汇总

ListContingentValues 函数用于列出表中的条件值。 可以为字段组名称和子类型指定搜索条件,从而限制所返回的列表。

语法

ListContingentValues(table, {field_group_name}, {subtype_code})

参数 说明 数据类型

table

A table that has contingent values.

String

field_group_name

The field group name to limit the results returned. Only contingent values for the field group specified will be returned.

(默认值为 All)

String

subtype_code

The subtype code to limit the results returned. Only contingent values for the subtype specified will be returned.

(默认值为 All)

Long

返回值

数据类型 说明

Object

ContingentValue 对象的列表。 每个对象都包含条件值的属性。

代码示例

ListContingentValues 示例

列出并描述名为 MyFieldGroup 的字段组的条件值属性。

import arcpy
CVs = arcpy.da.ListContingentValues("C:\\MyProject\\myConn.sde\\mygdb.USER1.myFC", "MyFieldGroup")
for cv in CVs:
    print("Subtype: {}\nIs retired: {}\nContingent Value Id: {}\nValues: \n".format(cv.subtype, cv.isRetired, cv.id))
    for v in cv.values:
        print(" Field Name: {}\n Field Value Type: {}""".format(v.name, v.type))
        if v.type == "CODED_VALUE":
            print(" Field Value Code: {}\n".format(v.code))
        if v.type == "RANGE":
            print(" Field Range: {}\n".format(v.range))