Clarity PPM

Expand all | Collapse all

Reading Calculated Attribute in GEL Script?

  • 1.  Reading Calculated Attribute in GEL Script?

    Posted 04-27-2017 02:45 PM

    We are developing a process and need to read Calculated Attribute (e.g. Risk Score) in the GEL script to compare with Threshold in GEL Parameters and update another attribute.
    We tried few ways of capturing the calculated attribute in GEL script but not able to.
    Is there any way to capture calculated attribute in GEL script?
    Our design in based on ability to do the same, please update

     

    Following code does not read the calculated attribute

    <gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:sql="jelly:sql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!-- Get Validables -->
    <core:set value="${project.thisProject.dfs_risk_score}" var="l_totalRiskScore"/>
    <core:set value="${thisProject.dfs_risk_score}" var="l_totalRiskScore1"/>
    <core:set value="${project.dfs_risk_score}" var="l_totalRiskScore2"/>

    <gel:log>project.thisProject.dfs_risk_score = ${project.thisProject.dfs_risk_score}</gel:log>
    <gel:log>l_totalRiskScore = ${l_totalRiskScore}</gel:log>
    <gel:log>l_totalRiskScore1 = ${l_totalRiskScore1}</gel:log>
    <gel:log>l_totalRiskScore2 = ${l_totalRiskScore2}</gel:log>
    </gel:script>



  • 2.  Re: Reading Calculated Attribute in GEL Script?

    Posted 04-27-2017 04:23 PM

    Calculated attributes are virtual attributes so don't really exist in the "data" they are calculated and displayed by the application when needed.

     

    So you would just need to re-calculate the attribute value in the GEL script using the same formula as you do in the object definition.



  • 3.  Re: Reading Calculated Attribute in GEL Script?

    Posted 04-28-2017 04:14 AM

    Have you looked at the database views (eg odf_risk_v and odf_risk_v2)?  Isn't calculated_risk_map_nls the required attribute, assuming you want the 'Low', 'High' etc value returned, otherwise, use calculated_risk which will return 1, 2 etc.



  • 4.  Re: Reading Calculated Attribute in GEL Script?

    Posted 04-28-2017 05:25 AM

    Agree, calculated values can be retrieved from  views.

    You would need a query to get the values from the views.



  • 5.  Re: Reading Calculated Attribute in GEL Script?

    Posted 04-28-2017 05:33 AM

    Yes you could read from the view as well, the problem that Sanjay had was that he was trying to just reference it from the properties associated with the object-instance that the GEL script is running against and I was just trying to make the point that its not there!

     

    Whether its easier to code the calculation using the instance properties that are there or add code to the GEL script to execute the query is debatable and upto Sanjay to determine! 



  • 6.  Re: Reading Calculated Attribute in GEL Script?

    Posted 05-02-2017 10:29 AM

    Thanks for replies I could find custom calculated attribute under ODF_PROJECT_V2 and is getting real time updated. Thanks for help



  • 7.  Re: Reading Calculated Attribute in GEL Script?

    Posted 04-29-2017 09:08 AM

    I agree these fields wont get save in data base as a column, however when ever we need to fetch these we can use same formula being used for this field or we can call view where this field is being calculated by using same fomula.