Assign all values of enumeration Type - Forum - Corticon - Progress Community

Assign all values of enumeration Type

 Forum

Assign all values of enumeration Type

This question is answered

Hi,

I have an entity Field with a relation 1 to many with fielData.

I want to know if is there's a way to create as many new fieldData as all values of an enumeration.

As I show in this image in the second column.

Thanks in advance

Verified Answer
  • Unfortunately Corticon doesn't allow you to iterate through the list of defined enumeration elements in the vocabulary to create all your data in one action row. Your rules will need to create the necessary FieldData based on the enumeration values (as you have done in the example). Alternatively, you could build a standalone operator extension using the CorticonFoundation.jar found on ESD, to iterate programmatically through your enumerations for the custom datatype in the rulesheet's corresponding vocabulary. But that seems a lot of effort compared with the rules you already created. :-)

  • Another option if the list is (very) long is to (manually) create the list of actions in your favourite text editor and then use cut/paste to populate the action section of the rule sheet. You can open (a copy of) the ecore file in the editor, find the definitions of the CDT in the ecore file, copy that part to a new file, and do some text manipulation with that to define the requested format of the actions. Of course you need to be comfortable manipulating text in text editors. Also PLEASE make sure that you are not editing (and saving) the ecore file outside of the vocabulary editor since that may potentially break the vocabulary in Corticon!

    On a non-related note, the syntax for the CDT values is not correct in the screen shot. Instead of using the dot notation as is used in Java (enum.label), in Corticon you should use a hash tag: cdtName#cdtLabel. This is the correct supported syntax.

All Replies
  • Unfortunately Corticon doesn't allow you to iterate through the list of defined enumeration elements in the vocabulary to create all your data in one action row. Your rules will need to create the necessary FieldData based on the enumeration values (as you have done in the example). Alternatively, you could build a standalone operator extension using the CorticonFoundation.jar found on ESD, to iterate programmatically through your enumerations for the custom datatype in the rulesheet's corresponding vocabulary. But that seems a lot of effort compared with the rules you already created. :-)

  • Another option if the list is (very) long is to (manually) create the list of actions in your favourite text editor and then use cut/paste to populate the action section of the rule sheet. You can open (a copy of) the ecore file in the editor, find the definitions of the CDT in the ecore file, copy that part to a new file, and do some text manipulation with that to define the requested format of the actions. Of course you need to be comfortable manipulating text in text editors. Also PLEASE make sure that you are not editing (and saving) the ecore file outside of the vocabulary editor since that may potentially break the vocabulary in Corticon!

    On a non-related note, the syntax for the CDT values is not correct in the screen shot. Instead of using the dot notation as is used in Java (enum.label), in Corticon you should use a hash tag: cdtName#cdtLabel. This is the correct supported syntax.

  • Hi,

    More or less it was the solution, first create the output with my text editor an then copy directy to corticon Studio output.

    Thanks for your help!