CA Service Management

 View Only
  • 1.  PDM_LIST Problem

    Posted Jul 19, 2016 04:55 PM

    when I run the code below happens as aprece in photo 1

    <PDM_LIST  PREFIX=list FACTORY=pcat WHERE="zContrato_ID = '400077'">

     

      ids = "<p>"  +ids +  "$list.id" + " | "+ "$list.sym" +   " | "+"</p>";

     

    </PDM_LIST>

    document.writeln( ids );

     

    1.png

     

    but if I run a query in SQL Server the following result is shown

    2.png

     

    question: how I move on to the next record in a PDM_LIST ?

     

    PS : I used PDM_LIST in other cases and never had this problem

    sorry for poor english



  • 2.  Re: PDM_LIST Problem

    Posted Jul 19, 2016 06:57 PM

    Try this:

    ids="";

    <PDM_LIST  PREFIX=zlist FACTORY=pcat WHERE="zContrato_ID = '400077'">

      ids += "<p>$zlist.id | $zlist.sym |</p>";

    </PDM_LIST>

    document.writeln( ids );

     

    Also, if zContrato_ID is defined as an integer then you should remove the ' ' surrounding 400077.



  • 3.  Re: PDM_LIST Problem

    Posted Jul 20, 2016 06:54 AM

    It happened the same problem



  • 4.  Re: PDM_LIST Problem

    Posted Jul 20, 2016 08:28 AM

    Refering to the first post, looks like you are running your query in another loop. could you share full code?



  • 5.  Re: PDM_LIST Problem

    Posted Jul 20, 2016 12:58 PM

    The code ran perfectly on my detail_cr.htmpl file (except that my where clause was "cr_flag = 1").

     

    How is zContrato_ID defined on your pcat object?



  • 6.  Re: PDM_LIST Problem

    Posted Jul 20, 2016 09:16 AM

    My code

     

    <script language = "javascript">

     

    var ids = "";

    <PDM_LIST  PREFIX=list  FACTORY=pcat  WHERE="zContrato_ID = '400077' ">

      someValue = "$list.sym";

      persidCat =  "$list.persistent_id";

      ids += "<p>$list.id | $list.sym |</p>";

     

    </PDM_LIST>

    document.writeln( ids );

    </script>



  • 7.  Re: PDM_LIST Problem
    Best Answer

    Posted Jul 20, 2016 10:12 AM

    This is really strange, the only reason I can figure, that whereclause have appended with IN statement, which returns multiple rows of same data.

    Better way is to resolve rootcause of problem but workaround could be to push data in JavaScript array:

    listResult = {};
    <PDM_LIST  PREFIX=list  FACTORY=pcat  WHERE="zContrato_ID = '400077' ">
      someValue = "$list.sym";
      persidCat = "$list.persistent_id";
      if !(Number($list.id) in obj)
      obj[Number($list.id)] = "$list.sym";
    </PDM_LIST>
    for (key in listResult) {
      document.writeln('<p>' + key + ':' + listResult[key] + '</p>');
    }
    


  • 8.  Re: PDM_LIST Problem

    Posted Jul 20, 2016 02:53 PM

    Thanks, this work for me!