Clarity PPM1

Expand all | Collapse all

Using >= or <= in query of GEL part 2

Jump to Best Answer
  • 1.  Using >= or <= in query of GEL part 2

    Posted 08-31-2016 03:53 PM

    Having looked at Using >= or <= in query of GEL      

    the answer seemed to be to use &lt; or CDATA

    and escapeText="False"

     

    For some reason that did not fly for me less than and greater than without the equal sign.

    < is no problem, but

    > is interpreted as an XML end tag with no matching element and start tag.

     

    The solution was to format the comparison so that only <  is used.

     

    Anybody have comments on this?



  • 2.  Re: Using >= or <= in query of GEL part 2

     
    Posted 09-24-2016 05:22 AM

    Please use > symbol like below

     

     <core:if test="${result_task.rowCount gt 0}">
                <core:set value="${result_task.rows[0].PRID}" var="imp_task"/>
              </core:if>



  • 3.  Re: Using >= or <= in query of GEL part 2
    Best Answer

     
    Posted 09-24-2016 05:23 AM

    Please use > symbol like below

     

     <core:if test="${result_task.rowCount gt 0}">
                <core:set value="${result_task.rows[0].PRID}" var="imp_task"/>
              </core:if>



  • 4.  Re: Using >= or <= in query of GEL part 2

    Posted 09-24-2016 12:08 PM

    Here is a trick I have used in the past.

    So the sql tag body is going to process the contents as XML so <> are troublesome.

     

    I use the sql attribute on the tag as it expects a string.

     

    Consider this:

     

    <?xml version="1.0" encoding="utf-8"?>
    <gel:script xmlns:core="jelly:core"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:sql="jelly:sql"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


    <sql:setDataSource url="jdbc:sqlserver://localhost;databaseName=niku;integratedSecurity=true;" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" user="niku" password="password" var="clarityDS" />

    <sql:query dataSource="${clarityDS}" var="queryOne" sql="
    select UNIQUE_NAME
    from [niku].[SRM_RESOURCES]
    where id &gt;= 1
    and id &lt;= 9"

    />

    <core:forEach trim="true" items="${queryOne.rowsByIndex}" var="row">
    <core:forEach var="columnName" items="${queryOne.getColumnNames()}" indexVar="i">
    <gel:out>${columnName} = ${row[i]}</gel:out>
    </core:forEach>
    </core:forEach>
    </gel:script>

     

    which gives

     

    V/r,

    Gene



  • 5.  Re: Using >= or <= in query of GEL part 2

    Posted 03-14-2018 11:37 PM

    Hi Gene,

     

    Thanks for the above example. I liked the way you have passed the sql query as text to the sql attribute in the sql tag. It really helps.

     

    Thanks,

    Vasanth



  • 6.  Re: Using >= or <= in query of GEL part 2

    Posted 09-27-2016 03:25 PM

    Hi urmas - Did any of the responses help answer your question? Thanks, Chris



  • 7.  Re: Using >= or <= in query of GEL part 2

    Posted 09-30-2016 04:16 PM

    Yes

     <core:if test="${result_task.rowCount gt 0}">

    posted by  nagve01 

    helped me.

    <core:if test="${v_number_of_projects > 0}">

    works but

    <core:if test="${v_number_of_projects < 1}">

    does not and gives

    ERRORBPM-0703: Custom script syntax error at line 32, column 40: The value of attribute "test" associated with an element type "core:if" must not contain the '<' character.

    while

    <core:if test="${v_number_of_projects} lt 0}">

    does.

    For some reason

    &lt;

    did not work either in that place. Did not try that in a query.

    The Basic guide says

    In Jelly <sql:query> tag the "<" or ">" operators are not allowed. So this is an issue with Jelly and not with Gel Script.

     

    RESOLUTION:

    ============

    Use "between" in the WHERE clause instead of '<' or '>'.

     

    which would work in a query, but I do not know if that would work in <core:if



  • 8.  Re: Using >= or <= in query of GEL part 2

    Posted 09-30-2016 04:45 PM

    Here is how I did it in core:if

     

    <?xml version="1.0" encoding="UTF-8"?>
    <gel:script
         xmlns:core="jelly:core"
         xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
         xmlns:xog="http://www.niku.com/xog"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    >

              <core:set var="a" value="8962"/>
              <core:set var="t" value="8962"/>
              <core:set var="b" value="1000"/>

              <core:if test="${a gt b}"><gel:log>True</gel:log></core:if>
              <core:if test="${b lt a}"><gel:log>True</gel:log></core:if>
              
              <core:if test="${a gt t || a eq t}"><gel:log>True</gel:log></core:if>
              <core:if test="${a lt t || a eq t}"><gel:log>True</gel:log></core:if>

    </gel:script>

     

     

    V/r,

    Gene



  • 9.  Re: Using >= or <= in query of GEL part 2

    Posted 10-01-2016 02:01 PM

    Thanks  gcubed that looks the same as  nagve01 suggested and worked for me.