Clarity: XOG Write Custom Attributes and Default Values

Document ID : KB000022310
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Default values have been set for some of the fields on the Project Object. When creating the a new project in Clarity, the default values are taken into account and are filled in automatically. How should we construct our XML Open Gateway XOG input file for creating or updating an investment?

Steps to Reproduce:

  1. Login to Clarity as an administrator
  2. Admin Tool > Studio: Objects > Project Object > Attributes
    Create 3 new attributes and place them on a page in the Project Layout:
    "mydecimal001" > default = 99.12345
    "myintegernumber" > default = 831
    "mydateattribute" > default = 'Start of Next Month'
  3. Also, create a multi-value lookup attribute (my_mvl) and add to the configuration
  4. Main Application > Projects > Click 'New' button
    Fill in all required fields, save the project and view the custom fields
    Default values appear as expected in the custom fields
  5. Create a XOG Write xml file using the sample 'prj_project_write.xml' format
    XOG Write a new project

How do we specify no specific value so the XOG will pick up the default on creating a new investment?
How do we specify no specific value so the XOG will erase existing values on updating an existing investment?

Solution:

The configuration of the XOG Write file is important for the application to populate the default values on the custom attributes.
The following configuration details apply to Clarity 12.1 and beyond.

EXAMPLE #1:

If you XOG Write the project with the tag and you do not have any values entered for each custom attribute, the XOG will assume that you are overriding the default values and specifically want to have no values when the project is created.

A XOG Write File that contains the following will create a project and put NO VALUES into the custom attribute fields, because no values are specified here.

            <CustomInformation>
                <ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
                <ColumnValue name="mydecimal001"></ColumnValue>
                <ColumnValue name="myintegernumber"></ColumnValue>
                <ColumnValue name="mydateattribute"></ColumnValue>
            </CustomInformation>

EXAMPLE #2:

If you leave the specific custom attribute completely out of the XOG Write file, the XOG will pick up the default value, if it is defined on the custom attribute.

Using the example above, if 'myintegernumber' custom attribute has a defined, default value and that attribute is NOT included in the <CustomInformation> tag, when the project is created, the field will contain the default value. Keeping the other two attributes in the XOG write file without any value will create the project with no values in these fields or upon an update to an existing object instance, the value is updated to no value. If a value is entered here in the XOG Write file, it will write that value when the XOG write action completes. If the <CustomInformation> tag is completely left out of the XOG Write file, any custom attribute that has a default value defined will get populated when the XOG Write action completes.

            <CustomInformation>
                <ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
                <ColumnValue name="mydecimal001"></ColumnValue>
                <ColumnValue name="mydateattribute"></ColumnValue>
            </CustomInformation>

EXAMPLE #3:

Multi-Value Lookup items has a element. This behaves differently than single value lookup attributes or other types of attributes.
If the attribute is included in the tag, for removing all the existing list of selected values on an existing object instance, the attribute can be included, but the tag must not be included or an error message is generated


     Correct - to include selected values for creating or updating investments:
     <CustomInformation>
        <ColumnValue name="my_mvl">
           <Value>black</Value>
           <Value>blue</Value>
           <Value>brown</Value>
        </ColumnValue>
     </CustomInformation>

     Correct - to include the attribute with no selected values for creating or updating investments:
     <CustomInformation>
        <ColumnValue name="my_mvl">
        </ColumnValue>
     </CustomInformation>
 
     Incorrect - including the <Value></Value> tags without a value causes an error:
     <CustomInformation>
        <ColumnValue name="my_mvl">
           <Value></Value>
        </ColumnValue>
     </CustomInformation>
 
     <ErrorInformation>
      <Severity>FATAL</Severity> 
      <Description>XOG-3656: Investment Object operation failed: update</Description> 
      <Exception>
     ... more ...