First is called Component. Contains a name and a description field, both Strings
Second is called ComponentVersion. Contains an ExternalKey to the Component class and a version field, which is a string
I would like to add a field to the ComponentVersion class which is to be called name and is the name from the Component class concatonated with the version field from the ComponentVersion class with an underscore in between. This field should be read-only in both the database and the user interface as it is calculated when the ComponentVersion is created
Any idea if this is possible?
Kind Regards
Steve
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
https://wiki.openitop.org/doku.php?id=2_4_0:customization:xml_reference
extract: Define the attributes used to compose the friendly name of an object. By default, the friendly name will be rendered as a concatenation of the given attributes, separated by a white space. You can specify any other format by adding a dictionary entry 'Class:<myclass>/Name'. This format is given as a printf-like formatting expression (Only $s is supported. e.g. '%1$s of %2$s'). As such a format is located in the dictionary, it may be translated, and the friendly name would depend on the language of the end-user. Note that in iTop 2.0.3, a tag <format> was present in the XML files provided with iTop but it was not used, and that was misleading.</format></myclass>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In OnInsert method you can concat the fields using php code. But, first you need get the value of name field searching in Component where id = [the selected Component] and concat with the version value.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I have 2 classes
First is called Component. Contains a name and a description field, both Strings
Second is called ComponentVersion. Contains an ExternalKey to the Component class and a version field, which is a string
I would like to add a field to the ComponentVersion class which is to be called name and is the name from the Component class concatonated with the version field from the ComponentVersion class with an underscore in between. This field should be read-only in both the database and the user interface as it is calculated when the ComponentVersion is created
Any idea if this is possible?
Kind Regards
Steve
Assuming component_name is an externalField defined in the ComponentVersion class
Combined with a dictionary entry like:
<entry id="Class:ComponentVersion/Name" _delta="define"><![CDATA[%1$s_%2$s]]></entry>https://wiki.openitop.org/doku.php?id=2_4_0:customization:xml_reference
extract: Define the attributes used to compose the friendly name of an object. By default, the friendly name will be rendered as a concatenation of the given attributes, separated by a white space. You can specify any other format by adding a dictionary entry 'Class:<myclass>/Name'. This format is given as a printf-like formatting expression (Only $s is supported. e.g. '%1$s of %2$s'). As such a format is located in the dictionary, it may be translated, and the friendly name would depend on the language of the end-user. Note that in iTop 2.0.3, a tag <format> was present in the XML files provided with iTop but it was not used, and that was misleading.</format></myclass>
Hello.
Can be explained in more detail.
Where (in which file) should I add
??
The solution to my question has been found.
awesome thank you so much :)
Hi
As a follow up
Everything is working except for the last class which is called componentpackageversion.
This is a derived from the version class and componentpackage class which is itself derived from the customer and generic componentpackage classes.
It displays the id and not the concatonated values which i would have expected
/Steve
Steve Cocks ,
In OnInsert method you can concat the fields using php code. But, first you need get the value of name field searching in Component where id = [the selected Component] and concat with the version value.