Clarity

Expand all | Collapse all

Unable to xog an attribute through gel script which is an empty value in Clarity UI

  • 1.  Unable to xog an attribute through gel script which is an empty value in Clarity UI

    Posted 5 days ago
    Hi,

    I am currently stuck in a peculiar situation where a field which is empty in UI and while xogging out it doesn't have that attribute, but still I would like to update that particular attribute with some value. Is there any way out?

    For example in my code below the XogWrite response doesnt fetch nov_comment column value in xog output but I would like to update that nov_comment field through gel script.
    Check my code below and let me know in case of any details required.

    <gel:forEach select="$xogWriteResponse//NikuDataBus/CostPlans/CostPlan/Details/Detail" var="rows1">
    <gel:forEach select="$rows1/GroupingAttributes/GroupingAttribute" var="rows2">
    <gel:set asString="true" select="$rows2/@code/text()" var="role"/>
    <gel:set asString="true" select="$rows2/@value/text()" var="roleValue"/>

    <!-- Role 1 Budget - Travel & Meetings -->
    <core:if test="${role=='role_id' and roleValue=='bdgt_travel_and_meet'}">
    <gel:set select="$rows2/@value" value="aa02_bdgt_tnm_ind_fix"/>
    <!-- Set PO Num and Comment start -->
    <gel:forEach select="$rows1/CustomInformation/ColumnValue" var="rows3">
    <gel:set asString="true" select="$rows3/@name/text()" var="p_num"/>
    <core:if test="${p_num=='nov_po_num'}">
    <gel:set asString="true" select="$rows3[@name='nov_po_num']/text()" var="ponum"/>
    <core:catch var="dbException">
    <sql:query escapeText="false"
    var="getPO"><![CDATA[SELECT regexp_replace(?, '[^0-9]', '') as val1 from dual
    where length(regexp_replace(?, '[^0-9]', '')) = 10
    and regexp_replace(?, '[^0-9]', '') like '%300%']]><sql:param value="${ponum}"/>
    <sql:param value="${ponum}"/><sql:param value="${ponum}"/>
    </sql:query>
    </core:catch>
    <core:choose>
    <core:when test="${dbException != null}">
    <gel:log level="ERROR">Failed PO Query for ${roleValue}. Database::${dbException.getMessage()}</gel:log>
    </core:when>
    <core:when test="${getPO.RowCount != 1}">
    <gel:set select="$rows1/CustomInformation/ColumnValue[@name='nov_po_num']/text()" value=""/>
    <gel:set select="$rows1/CustomInformation/ColumnValue[@name='nov_comment']/text()" value="${ponum}"/>
    </core:when>
    <core:otherwise>
    <gel:set select="$rows1/CustomInformation/ColumnValue[@name='nov_po_num']/text()" value="${getPO.rows[0].val1}"/>
    <gel:set select="$rows1/CustomInformation/ColumnValue[@name='nov_comment']/text()" value="${ponum}"/>
    </core:otherwise>
    </core:choose>
    </core:if>
    </gel:forEach>
    <!-- Set PO Num and Comment end -->
    </core:if>
    </gel:forEach>
    </gel:forEach>


  • 2.  RE: Unable to xog an attribute through gel script which is an empty value in Clarity UI

    Posted 5 days ago
    Can you put a value in the UI and XOG it out to see that your tag is exactly the same?


  • 3.  RE: Unable to xog an attribute through gel script which is an empty value in Clarity UI

    Posted 5 days ago
    hi Martti,

    I have got the solution though..By using gel:parse  and 
    <gel:set select="$rows1/CustomInformation" value="${comment}" insert="true"/>
    I was able to make it work.Not sure what this exactly does though..Any idea?


  • 4.  RE: Unable to xog an attribute through gel script which is an empty value in Clarity UI

    Posted 3 days ago
    Edited by Nick Darlington 3 days ago
    The select attribute pulls a set of nodes containing your CustomInformation element in the XML.

    The ${comment} variable must contain your ColumnValue element with the name and value attributes set.

    Then it's the insert="true" attribute that specifically tells the gel:set tag that this is something new to be added as a child of the current selection, rather than just reading or writing existing elements and attributes.  So that insert attribute makes most of the difference here when trying to add something.

    You should probably review the examples from the documentation and try to understand how each of the different gel:set calls make changes to the XML variable, step by step, as it contains various different changes including the inserts:
    https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/clarity-project-and-portfolio-management-ppm-on-premise/15-7/reference/xml-open-gateway-xog-development/xog-gel-scripting/xog-gel-tag-library.html#concept.dita_d2e07c568ccbac72da09b5da6c6afff01d898a3c_gelsetSettingXMLDocumentValues


  • 5.  RE: Unable to xog an attribute through gel script which is an empty value in Clarity UI

    Posted 2 days ago
    Thank you Marrti and Nick..