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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Translate the entire conversation x

How to define drop-down values for a field dynamicaly?

AN_10548594
12-Amethyst

How to define drop-down values for a field dynamicaly?

How to define drop-down values for a field dynamicaly? Need a way to present different selection lists of the same field for different Requirement Documents. Like Colour (red,yellow,green) for one RD and Color (blue,green) for another. Any other ideas like playing with HTML code insertion?

Thanks

ACCEPTED SOLUTION

Accepted Solutions

Here are my two examples:

1) Dynamic picklist based on IBPL with constraint

A few of our projects have variants, We have implemented that as a boolean on the Project type to flag the items that are variants of another one.

For example, project "ABC" has variants "Var1" and "Var2", so we have three Project items, "ABC", "ABC/Var1", and "ABC/Var2". Note: the common root is "ABC" which we call the Program, so we know all three project items belong together.

Our issue tracking system is designed to assign Issues to Projects, but if the project has variants, then you can also refine that by specifying which variants are affected, if any.

On the Issue type, we use an IBPL called "Variants" that allows to pick any Project items flagged as a variant:

PTC Article 1-1.png

But we want to select only the variants that are relevant for the selected project, so we add a constraint on the Issue type. Note that the picklist we use for projects is not the "Project" field, but another one called "Project Link".  The constraint is:

PTC Article 2-1.png

Without going through all the details, the constraint essentially says "only select the variants that belong to the same Program but exclude the current project". For example, if our issue selects Project Link "ABC", then the two variants are shown. But if the Project Link is "ABC/Var1", then only the second variant is shown.

Examples:

PTC Article 3-1.png

 

PTC Article 3-2.png

 

2) Simple pick list with constraint

Our issues can be categorized, for example, if it's a Quality Issue, all possible values are defined here:

PTC Article 5-1.png

But on the Issue type, values are constrained based on some other field value used for further categorization:

PTC Article 4-1.png

 

I believe this answers the question "define drop-down values for a field dynamically?".

Note that no scripting (e.g. trigger) or "html code" are required.

View solution in original post

5 REPLIES 5

Hi @AN_10548594 

 

Thank you for your question.

 

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

 

Also, feel free to add any additional information you think might be relevant. For example:

  • Are you looking to present different selection lists for the same field based on different Requirement Documents?
  • How is the field currently configured in Windchill? Is it set up as a standard drop-down list, or does it have any custom attributes?
  • What specific values do you want to present in the drop-down list for each Requirement Document? Can you provide examples?

 

It sometimes helps to have screenshots to better understand what you are trying to do.

 

Best regards,


Catalina
PTC Community Moderator
PTC

Hello Catalina,

  • Are you looking to present different selection lists for the same field based on different Requirement Documents?
    • Yes
  • How is the field currently configured in Windchill? Is it set up as a standard drop-down list, or does it have any custom attributes?
    • it should be a standard pick field
  • What specific values do you want to present in the drop-down list for each Requirement Document? Can you provide examples?
    • Example is: pick field called Colours with values: Red, Green, Blue. For a 1st ReqDoc we select Red, Green. For a 2nd ReqDoc we select Red,Blue. For all requirements of 1st ReqDoc it's possible to select colours from a pick list that contains Red and Green only. For all requirements of 2nd ReqDoc it's possible to select colours from a pick list that contains Red and Blue only. So it's a single managed Colour field with all possible values and constrains are getting defined dynamicaly at ReqDoc level. Selected values are getting consumed by requirements.

Many thanks

 

For values that are truly dynamic, that is, the values cannot be predefined as picklist values, you should look at IBPL fields. You would have to define an item type to hold the values, and then the IBPL field allows you to have a dynamic picklist.

For values such as "Red", "Blue", etc., you would indeed use a picklist field. But then you should look at using constraints on the type(s) that uses it.

Note that you can also use constraints with IBPLs and also that constraints can be dynamic.

If you need more details, I'll try to find screenshots of our system where we have that kind of setup. Let me know if you need that.

Hello pal,

Would be very usefull if you could share these steps!

So far I'm starting to read docs :))

Regards

Here are my two examples:

1) Dynamic picklist based on IBPL with constraint

A few of our projects have variants, We have implemented that as a boolean on the Project type to flag the items that are variants of another one.

For example, project "ABC" has variants "Var1" and "Var2", so we have three Project items, "ABC", "ABC/Var1", and "ABC/Var2". Note: the common root is "ABC" which we call the Program, so we know all three project items belong together.

Our issue tracking system is designed to assign Issues to Projects, but if the project has variants, then you can also refine that by specifying which variants are affected, if any.

On the Issue type, we use an IBPL called "Variants" that allows to pick any Project items flagged as a variant:

PTC Article 1-1.png

But we want to select only the variants that are relevant for the selected project, so we add a constraint on the Issue type. Note that the picklist we use for projects is not the "Project" field, but another one called "Project Link".  The constraint is:

PTC Article 2-1.png

Without going through all the details, the constraint essentially says "only select the variants that belong to the same Program but exclude the current project". For example, if our issue selects Project Link "ABC", then the two variants are shown. But if the Project Link is "ABC/Var1", then only the second variant is shown.

Examples:

PTC Article 3-1.png

 

PTC Article 3-2.png

 

2) Simple pick list with constraint

Our issues can be categorized, for example, if it's a Quality Issue, all possible values are defined here:

PTC Article 5-1.png

But on the Issue type, values are constrained based on some other field value used for further categorization:

PTC Article 4-1.png

 

I believe this answers the question "define drop-down values for a field dynamically?".

Note that no scripting (e.g. trigger) or "html code" are required.

Announcements

Top Tags