Clarity

Expand all | Collapse all

Adding a read-only STRING attribute without a default value

  • 1.  Adding a read-only STRING attribute without a default value

    Broadcom Employee
    Posted 11-27-2017 10:54 AM

    I have always wanted to be able to create read-only attributes without a default (please vote:Ability to create READ ONLY attributes without the need to have a default value)

     

    It is possible with STRING attributes using that little trick.

     

    1) CA PPM gives this error when you're trying to create this attribute without a default value

     

     

    2) The trick is to type "null" (lowercase) as default value, then save

     

     

    3) CA PPM accepts it, and "null" is not the default value, but it is NULL 

     

     

     

    Unfortunately, this doesn't work for NUMBERS and DATES.

     

    Hope this helps,



  • 2.  Re: Adding a read-only STRING attribute without a default value

    Posted 11-28-2017 01:12 AM

    Thanks for sharing this is really a very neat trick for deafult values.



  • 3.  Re: Adding a read-only STRING attribute without a default value

    Posted 11-28-2017 03:38 AM

    Thanks,

    This using the nonprintable space ASCII 255 has been the trick used.



  • 4.  Re: Adding a read-only STRING attribute without a default value

    Posted 11-29-2017 08:12 AM

    You can also do this through XOG for any type

    xog out the object, send back in just the attribute in question with editable="false"

     

     

    Example for custom attribute on the project

    <?xml version="1.0"?>
    <NikuDataBus xsi:noNamespaceSchemaLocation="../xsd/nikuxog_contentPack.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Header version="15.3" objectType="contentPack" externalSource="NIKU" action="write"/>
    <contentPack update="true">
    <objects>
    <object update="true" source="niku.com" raiseEvents="true" periodStartAttribute="odf_period_start" periodEndAttribute="odf_period_end"
    partitionModelCode="niku" pageLayoutAttribute="page_layout" pageInstanceType="SRM_PROJECTS" fiscalPeriodTypeAttribute="odf_period_type" entityCodeAttribute="entity" code="project">

    <customAttribute code="myattribute" virtual="false" unique="false" required="false" private="false" presenceRequired="false"
    partitionMode="PARTITION_AND_ANSTRS_DESDNTS" partitionCode="NIKU.ROOT" multiValued="false" lookupType="my_lookup"
    extendedType="lookup" editable="false" dataType="string" dataSize="30" custom="true" currencyConnected="false"
    constant="false" column="myattribute" active="true">

    </customAttribute>
    </object>
    </objects>
    </contentPack>
    </NikuDataBus>


  • 5.  Re: Adding a read-only STRING attribute without a default value

    Broadcom Employee
    Posted 11-29-2017 10:58 AM

    That's a pretty good idea. Didn't think of it. And i suppose it works for every kind of attribute type?



  • 6.  Re: Adding a read-only STRING attribute without a default value

    Posted 11-29-2017 12:25 PM

    I expect so. Not tried for everything i.e. TSV



  • 7.  Re: Adding a read-only STRING attribute without a default value

    Posted 12-04-2017 06:55 AM

    Hello, It's a good trick but it will not work in case of Lookup field. correct?