cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

How to get constraints(allowed values) of the type/field

MartinBeisser
3-Newcomer

How to get constraints(allowed values) of the type/field

Hi,

 

We have some constraints on basic/field relationsips e.g. of the field "category".

We want the get the allowed values of this field via api/commandline.

 

What we must do?

 

Thanks in advance

1 REPLY 1

You can view the field relationships with "im viewtype" on either command line or API.

 

The following is the Field Relationship section of "im viewtype" for a sample Requirement type:

CLI:

Field Relationships:
Referenced Item Type=Requirement Specification Document:Category=Document
Referenced Item Type=Shared Requirement:Category=Technical Requirement,System Requirement,Component Requirement,Heading,Business Requirement,Comment,User Requirement,Functional Requirement,Non-Functional Requirement,SRS (Software Requirement),SSS (System/Subsystem Requirement),IRS (Interface Requirement)
constraintrule=(((field["Category"] = "Non-Functional Requirement") or (field["Category"] = "Functional Requirement")) and (field["State"] = "Cancelled")):Additional Comments=:all,mandatory,description=test rule

 

API:

      <Field name="fieldRelationships">
        <List elementType="item">
          <Item id="Referenced Item Type" modelType="im.Field" displayId="Referenced Item Type">
            <Field name="targetFields">
              <List elementType="item">
                <Item id="Category" modelType="im.Field" displayId="Category">
                  <Field name="sourceValues">
                    <List>
                      <Value dataType="string">Requirement Specification Document</Value>
                    </List>
                  </Field>
                  <Field name="targetValues">
                    <List>
                      <Value dataType="string">Document</Value>
                    </List>
                  </Field>
                  <Field name="targetValueType">
                    <Value dataType="string">static</Value>
                  </Field>
                  <Field name="mandatory">
                    <Value dataType="boolean">false</Value>
                  </Field>
                  <Field name="errMandatory">
                    <Value></Value>
                  </Field>
                  <Field name="errInvalidated">
                    <Value></Value>
                  </Field>
                  <Field name="description">
                    <Value></Value>
                  </Field>
                  <Field name="cliSpec">
                    <Value dataType="string">Referenced Item Type=Requirement Specification Document:Category=Document</Value>
                  </Field>
                  <Field name="all">
                    <Value dataType="boolean">false</Value>
                  </Field>
                </Item>
                <Item id="Category" modelType="im.Field" displayId="Category">
                  <Field name="sourceValues">
                    <List>
                      <Value dataType="string">Shared Requirement</Value>
                    </List>
                  </Field>
                  <Field name="targetValues">
                    <List>
                      <Value dataType="string">Technical Requirement</Value>
                      <Value dataType="string">System Requirement</Value>
                      <Value dataType="string">Component Requirement</Value>
                      <Value dataType="string">Heading</Value>
                      <Value dataType="string">Business Requirement</Value>
                      <Value dataType="string">Comment</Value>
                      <Value dataType="string">User Requirement</Value>
                      <Value dataType="string">Functional Requirement</Value>
                      <Value dataType="string">Non-Functional Requirement</Value>
                      <Value dataType="string">SRS (Software Requirement)</Value>
                      <Value dataType="string">SSS (System/Subsystem Requirement)</Value>
                      <Value dataType="string">IRS (Interface Requirement)</Value>
                    </List>
                  </Field>
                  <Field name="targetValueType">
                    <Value dataType="string">static</Value>
                  </Field>
                  <Field name="mandatory">
                    <Value dataType="boolean">false</Value>
                  </Field>
                  <Field name="errMandatory">
                    <Value></Value>
                  </Field>
                  <Field name="errInvalidated">
                    <Value></Value>
                  </Field>
                  <Field name="description">
                    <Value></Value>
                  </Field>
                  <Field name="cliSpec">
                    <Value dataType="string">Referenced Item Type=Shared Requirement:Category=Technical Requirement,System Requirement,Component Requirement,Heading,Business Requirement,Comment,User Requirement,Functional Requirement,Non-Functional Requirement,SRS (Software Requirement),SSS (System/Subsystem Requirement),IRS (Interface Requirement)</Value>
                  </Field>
                  <Field name="all">
                    <Value dataType="boolean">false</Value>
                  </Field>
                </Item>
              </List>
            </Field>
          </Item>
          <Item id="constraintrule=(((field[&quot;Category&quot;] = &quot;Non-Functional Requirement&quot;) or (field[&quot;Category&quot;] = &quot;Functional Requirement&quot;)) and (field[&quot;State&quot;] = &quot;Cancelled&quot;)):Additional Comments=:all,mandatory,description=test rule" modelType="ConstraintRule" displayId="constraintrule=(((field[&quot;Category&quot;] = &quot;Non-Functional Requirement&quot;) or (field[&quot;Category&quot;] = &quot;Functional Requirement&quot;)) and (field[&quot;State&quot;] = &quot;Cancelled&quot;)):Additional Comments=:all,mandatory,description=test rule">
            <Field name="targetField">
              <Item id="Additional Comments" modelType="im.Field" displayId="Additional Comments">
              </Item>
            </Field>
            <Field name="rule">
              <Value dataType="string">(((field["Category"] = "Non-Functional Requirement") or (field["Category"] = "Functional Requirement")) and (field["State"] = "Cancelled"))</Value>
            </Field>
            <Field name="mandatory">
              <Value dataType="boolean">true</Value>
            </Field>
            <Field name="errMandatory">
              <Value></Value>
            </Field>
            <Field name="errInvalidated">
              <Value></Value>
            </Field>
            <Field name="description">
              <Value dataType="string">test rule</Value>
            </Field>
            <Field name="cliSpec">
              <Value dataType="string">constraintrule=(((field["Category"] = "Non-Functional Requirement") or (field["Category"] = "Functional Requirement")) and (field["State"] = "Cancelled")):Additional Comments=:all,mandatory,description=test rule</Value>
            </Field>
            <Field name="all">
              <Value dataType="boolean">true</Value>
            </Field>
            <Field name="targetValues">
              <Value></Value>
            </Field>
            <Field name="targetValueType">
              <Value dataType="string">static</Value>
            </Field>
          </Item>
        </List>
      </Field>

 

You can also see all values for the Category with "im viewfield --overrideForType="[shared item type]" "Shared Category". im viewfield and im viewtype are both published API commands. 

 

Announcements


Top Tags