Clarity

 View Only
Expand all | Collapse all

Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

  • 1.  Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Mar 27, 2019 10:11 AM
    Edited by Pat Douglas Oct 21, 2019 02:35 PM



  • 2.  Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Mar 27, 2019 10:57 AM

    At a glance your XOG XML looks correct for the lookup bit - have you tried just running the produced XML in a non-GEL XOG client?

     

    I know that some older versions (13.x) there were issues with XOG-ing in multi valued lookups though - sorry I don't have any bug numbers though.



  • 3.  Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Mar 27, 2019 11:41 AM

    Yeah - the XOG portion looks good if I manually enter the values for the MVL. My problem is pulling the MVL values with the SQL script and having them inserted into the XOG. The tda_data_class value from the originating custom object could have anywhere from zero to 9 values. I originally tried making the SQL look at each sequence id in the MVL and insert the value - null or not. However, the XOG for the MVL does not like NULL values, so I had to find a way to only insert a value for the MVL is the value was present in the originating custom object for tda_data_class.



  • 4.  Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.
    Best Answer

    Posted Mar 27, 2019 12:29 PM

    Just guessing.

     

    It looks like int line 78 you are writing over your rows with a single row.

     

     

    So when you get to line 102, you no longer have a arraylist of rows but just a single row.

     

     

    So data_class.rows[i].value returns a null / empty string.

     

    V/r,

    Gene



  • 5.  Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Mar 27, 2019 02:04 PM

    That's it - can't believe I missed that. Thank you!



  • 6.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 28, 2019 10:03 PM
      |   view attached
    Hi Port, 

    I tried creating the array lists but it is still giving me the error with the empty values. Please find the attached gel script and do let me know your feedback.

    Attachment(s)

    xml
    AOP Copy.xml   9 KB 1 version


  • 7.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 28, 2019 09:36 PM
    Hi Eugene, 

    Could you please help me understand how can I give the array List as you mentioned ? I am also facing the similar problem.


  • 8.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 29, 2019 04:42 AM

    I didn't understand line 83.  You are iterating over the data_class rows but using the index on the on_hold_rows.  Given the query for on_hold_rows, it looks like it should only have one row in the results set.

    V/r,
    Gene




  • 9.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 29, 2019 09:15 AM
    Project ID and Project Name -> On_Hold_rows which contains only one row but data_class contains two rows. I am not sure where should 

    This is the XOG INPUt getting generated with the empty values 

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd"> <Header action="write" externalSource="NIKU" objectType="project" version="15.6"/> <Projects> <Project> <CustomInformation> <ColumnValue name="prj_sumt_aop_yr"> <Value/> <Value/> </ColumnValue> </CustomInformation> </Project> </Projects> </NikuDataBus>

    Error Message : 

    <XOGOutput xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/status.xsd"> <Object type="project"/> <Status elapsedTime="0.0 seconds" state="FAILURE"/> <Statistics failureRecords="0" insertedRecords="0" totalNumberOfRecords="0" updatedRecords="0"/> <ErrorInformation> <Severity>FATAL</Severity> <Description>[Error] :1:1: element "Project" is missing "projectID" attribute </Description> <Exception type="java.lang.Exception">Invalid xml data</Exception> </ErrorInformation> </XOGOutput>

    This is how I updated logic now. I am NOT sure where it is pulling empty values.



  • 10.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 29, 2019 10:25 AM
    Now I have changed the code 

    <core:choose><core:choose>      <!--  If there is an exception log it -->      <core:when test="${dbException != null}">        <gel:log level="ERROR">Database Error while querying data : ${dbException}</gel:log>      </core:when>      <core:otherwise>        <!-- set variables based upon query results -->        <core:forEach indexVar="i" items="${on_hold.rows}" var="on_hold">               <core:set value="${on_hold.get('project_code')}" var="v_proj_code"/>    <gel:log level="DEBUG">${on_hold.get('project_code')}</gel:log>               <core:set value="${on_hold.get('project_name')}" var="v_proj_name"/>     <gel:log level="DEBUG">${on_hold.get('project_name')}</gel:log>            <gel:parse var="v_child_xml">                                                           <Project name="${v_proj_name}" projectID="${v_proj_code}" >                                           <CustomInformation> <ColumnValue name="prj_sumt_aop_yr"> <core:forEach items="${data_class.rowsByIndex}" trim="true" var="data_class"> <Value>${data_class.rows[i].value}</Value> </core:forEach>  <!--<core:forEach items="${data_class.rows}" var="row" >                                                     <core:invokeStatic var="rowString" className="org.apache.commons.lang.ArrayUtils" method="toString" >                                                     <core:arg type="java.lang.Object" value="${row}" />                                                     </core:invokeStatic>                                                     <gel:log level="DEBUG">${rowString}</gel:log>                                                     </core:forEach>-->  </ColumnValue> </CustomInformation>                                           </Project>            </gel:parse>              <gel:set insert="true" select="$v_xog/NikuDataBus/Projects" value="${v_child_xml}"/>                </core:forEach>             </core:otherwise>                    </core:choose>

    Now XOG is getting generated 

    XOG_INPUT = <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd"> <Header action="write" externalSource="NIKU" objectType="project" version="15.6"/> <Projects> <Project name="AOP Test 1.2" projectID="PRJ00880"> <CustomInformation> <ColumnValue name="cmi_prj_sumt_aop_yr"> <Value/> </ColumnValue> </CustomInformation> </Project> </Projects> </NikuDataBus>

    I am getting this error message now 

    XOG_OUTPUT = <XOGOutput xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/status.xsd"> <Object type="project"/> <Status elapsedTime="4.336 seconds" state="FAILURE"/> <Statistics failureRecords="1" insertedRecords="0" totalNumberOfRecords="1" updatedRecords="0"/> <Records> <Record> <KeyInformation> <column name="ID">5070096</column> <column name="name">AOP Test 1.2</column> <column name="UNIQUE_NAME">PRJ00880</column> </KeyInformation> <ErrorInformation> <Severity>FATAL</Severity> <Description>Project Object update failed</Description> <Exception><![CDATA[ java.lang.Exception: INV-0021: Planned Cost Finish date is earlier than Planned Cost Start date at com.niku.xog.util.XOGContinueHandler.postProcess(XOGContinueHandler.java:38) at com.niku.xql2.XQLVisitor.postProcess(XQLVisitor.java:1417) at com.niku.union.xml.dom.DOMWalker.postProcess(DOMWalker.java:210) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:94) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:92) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:51) at com.niku.xql2.handlers.MatchHandler.preProcess(MatchHandler.java:129) at com.niku.xql2.XQLVisitor.preProcess(XQLVisitor.java:1383) at com.niku.union.xml.dom.DOMWalker.preProcess(DOMWalker.java:194) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:74) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:51) at com.niku.xql2.handlers.TryHandler.preProcess(TryHandler.java:54) at com.niku.xql2.XQLVisitor.preProcess(XQLVisitor.java:1383) at com.niku.union.xml.dom.DOMWalker.preProcess(DOMWalker.java:194) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:74) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:51) at com.niku.xql2.handlers.LoopHandler.processObject(LoopHandler.java:388) at com.niku.xql2.handlers.LoopHandler.processSet(LoopHandler.java:259) at com.niku.xql2.handlers.LoopHandler.preProcess(LoopHandler.java:216) at com.niku.xql2.XQLVisitor.preProcess(XQLVisitor.java:1383) at com.niku.union.xml.dom.DOMWalker.preProcess(DOMWalker.java:194) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:74) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:51) at com.niku.xql2.handlers.LoopHandler.processObject(LoopHandler.java:388) at com.niku.xql2.handlers.LoopHandler.processSet(LoopHandler.java:259) at com.niku.xql2.handlers.LoopHandler.preProcess(LoopHandler.java:216) at com.niku.xql2.XQLVisitor.preProcess(XQLVisitor.java:1383) at com.niku.union.xml.dom.DOMWalker.preProcess(DOMWalker.java:194) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:74) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:51) at com.niku.xql2.handlers.LoopHandler.processObject(LoopHandler.java:388) at com.niku.xql2.handlers.LoopHandler.processSet(LoopHandler.java:259) at com.niku.xql2.handlers.LoopHandler.preProcess(LoopHandler.java:216) at com.niku.xql2.XQLVisitor.preProcess(XQLVisitor.java:1383) at com.niku.union.xml.dom.DOMWalker.preProcess(DOMWalker.java:194) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:74) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:92) at com.niku.union.xml.dom.DOMWalker.traverseIntern(DOMWalker.java:92) at com.niku.union.xml.dom.DOMWalker.traverse(DOMWalker.java:36) at com.niku.xog.service.XOGXBLHandler.processXBL(XOGXBLHandler.java:261) at com.niku.xog.service.XOGXBLHandler.process(XOGXBLHandler.java:168) at com.niku.xog.service.ObjectHandler.processRequest(ObjectHandler.java:180) at com.niku.xog.service.ObjectHandler.process(ObjectHandler.java:97) at com.niku.xog.service.XOGDispatch.processMessage(XOGDispatch.java:133) at co



  • 11.  RE: Re: Gelscript for Multi-valued Lookup that can have anywhere between 0 & 9 entries.

    Posted Aug 29, 2019 12:26 PM
    Thank you Eugine, I got the point where it messed up and I have corrected it. Now I get some weird error that Planned Cost Finish date is earlier that Planned Cost Start date when it is Xogging the data. I am working on it to figure it out