Clarity

  • 1.  How to update the value of a lookup using a sql statement?

    Posted Jul 13, 2018 12:40 PM

    We have introduced a new field (lookup) I need to write a sql statement to automatically update the values based on a condition. How can I achieve that?



  • 2.  Re: How to update the value of a lookup using a sql statement?

    Posted Jul 13, 2018 12:49 PM

    i will suggest xog to update lookup field based on your business logic which you can fetch as sql select statement in gel script process which can be auto trigger using some start condition.



  • 3.  Re: How to update the value of a lookup using a sql statement?

    Posted Jul 13, 2018 01:15 PM

    ok but what is the syntax for the sql statement? that is my question.



  • 4.  Re: How to update the value of a lookup using a sql statement?

    Posted Jul 13, 2018 02:08 PM

    i will suggest you to check GEL Scripting site for syntax  

     

    <!-- QUERY FOR MULTIPLE RESULTS -->
    <sql:query escapeText="0" var="multipleResults">
         <![CDATA[
    SELECT FULL_NAME
    FROM SRM_RESOURCES
    ]]>

    </sql:query>

    <core:forEach items="${multipleResults.rows}" trim="true" var="row">
         <core:set value="${row.FULL_NAME}" var="firstColumn"/>
    </core:forEach>
    <!-- CHOOSE PREFERENCE -->
    <core:forEach items="${multipleResults.rowsByIndex}" trim="true" var="row">
         <core:set value="${row[0]}" var="firstColumn"/>
    </core:forEach>