Getting the row field value corresponding to invoice

Sort:
You are not authorized to post a reply.
Author
Messages
Subic
Basic Member
Posts: 7
Basic Member
    Hi,

     I am trying to get the value from each row that is corresponding to invoices.I have tried using button and image link. but both are not working.

    Button option

    when I click first button, getting the correct value from line1. but when i click the second row button, still getting row1 value.


    Image option using the field id.


    when click line 1 image, getting value from the last row values. Because, each row, we are comparing all line with same value.

    My sample code is here.

    if(lawForm.getElementValue("_f67r0",row)=="D")
        {
            url="";
            url = "http://abc:8080/ImageSearchServlet";
                url = url + "?frmVdrNbr="+lawForm.getDataValue("VENDOR");
            url = url + "&frmInvNbr="+lawForm.getElementValue("_f54r0");
            url = url + "&frmIPrntNbr="+lawForm.getElementValue("_f61r0");
            url = url + "&fileOptions=true&printOptions=true";
            var winValue =     window.open(url,"File",'resizable=yes,scrollbars=no,toolbar=no,directories=no,status=yes,menubar=no,copyhistory=no');    
        }    
        if(lawForm.getElementValue("_f67r1",row)=="D")
        {
            url="";
            url = "http://abc:8080/ImageSearchServlet";
                url = url + "?frmVdrNbr="+lawForm.getDataValue("API-VENDOR");
            url = url + "&frmInvNbr="+lawForm.getElementValue("_f54r1");
            url = url + "&frmIPrntNbr="+lawForm.getElementValue("_f61r1");
            url = url + "&fileOptions=true&printOptions=true";
            var winValue = window.open(url,"file",'resizable=yes,scrollbars=no,toolbar=no,directories=no,status=yes,menubar=no,copyhistory=no');    
        }    
        if(lawForm.getElementValue("_f67r2",row)=="D")
        {
            url="";
            url = "http://abc:8080/ImageSearchServlet";
                url = url + "?frmVdrNbr="+lawForm.getDataValue("API-VENDOR");    
            url = url + "&frmInvNbr="+lawForm.getElementValue("_f54r2");
            url = url + "&frmIPrntNbr="+lawForm.getElementValue("_f61r2");
            url = url + "&fileOptions=true&printOptions=true";
            var winValue = window.open(url,"file",'resizable=yes,scrollbars=no,toolbar=no,directories=no,status=yes,menubar=no,copyhistory=no');    
        }            

    Please suggest me, if anyone have another idea.
    TracyO
    Veteran Member
    Posts: 97
    Veteran Member
      WHich form are you doing this on? Here is the code we have to pull up an image from AP90.1

      var rowSelected = 0;

      function grabAllFormValues()
      {
      Company = lawForm.getFormValue("text1", 0);
      if (Company == '')
      {
      alert("Cannot display image without a valid company value on the form.");
      exit;
      }

      Vendor = lawForm.getFormValue("text3", 0);
      if (Vendor == '')
      {
      alert("Cannot display image without a valid vendor value on the form.");
      exit;
      }

      while (Vendor.charAt(0)==" ")
      {
      var VendorLength=Vendor.length;
      Vendor = Vendor.slice(1,VendorLength);
      }
      Invoice = lawForm.getFormValue("out8", rowSelected);

      while (Invoice.charAt(0)==" ")
      {
      var InvoiceLength=Invoice.length;
      Invoice = Invoice.slice(1,InvoiceLength);
      }

      if (Invoice == '')
      {
      alert("Cannot display image without a valid invoice value on the form.");
      exit;
      }
      Drawer = lawForm.getFormValue("select1", rowSelected);

      while (Drawer.charAt(0)==" ")
      {
      var DrawerLength=Drawer.length;
      Drawer = Drawer.slice(1,DrawerLength);
      }

      if (Drawer == '')
      {
      alert("Cannot display image without a valid drawer value on the form.");
      exit;
      }





      }

      function DisplayImageWeb()
      {
      grabAllFormValues();
      if (Drawer == "PETRO")
      {
      Drawer = "Petro" + "leum";
      imgAddress = "http://inow:8080/webnow/index.jsp?action=document";
      imgAddress = imgAddress + "&drawer=" + Drawer;
      imgAddress = imgAddress + "&folder=";
      imgAddress = imgAddress + "&tab=";
      imgAddress = imgAddress + "&field3=" + Vendor;
      imgAddress = imgAddress + "&field4=" + Invoice;
      imgAddress = imgAddress + "&viewname=Petroleum";
      imgAddress = imgAddress + "&displaysearchwindow=true";


      }
      if (Drawer == "AP")
      {
      imgAddress = "http://inow:8080/webnow/index.jsp?action=document";
      imgAddress = imgAddress + "&drawer=" + Drawer;
      imgAddress = imgAddress + "&folder=" + Vendor;
      imgAddress = imgAddress + "&tab=" + Invoice;
      imgAddress = imgAddress + "&viewname=All Documents";
      imgAddress = imgAddress + "&displaysearchwindow=true";

      }
      imgWindow=window.open(imgAddress,"invoiceWindow","location=yes,menubar=no,resizable=yes,scrollbars=yes,titlebar=yes,toolbar=no");
      imgWindow.focus();

      return true;
      }

      function BUTTON_OnClick(id, row)
      {
      //alert(id + ", " + row);
      rowSelected = row;
      return true;
      }
      Subic
      Basic Member
      Posts: 7
      Basic Member
        Tracy,

        I have tried button on click option.

        Always, I am getting push8,-1 value for all rows. Here is the code.

        function BUTTON_OnClick(id, row)
        {

        if (id != "push8") {
        return true;
        }
        alert(id+","+row);

        var url = "http://abc:8080/ImageSearchServlet"
        url = url + "?frmVdrNbr=" + lawForm.getDataValue("API-VENDOR");
        url = url + "&frmInvNbr=" + trimText(lawForm.getFormValue("out12",rowSelected));
        url = url + "&frmIPrntNbr=" + trimText(lawForm.getFormValue("out16",rowSelected));
        url = url + "&fileOptions=true&printOptions=true";
        alert(url);
        var winValue = window.open(url,"File",'resizable=yes,scrollbars=no,toolbar=no,directories=no,status=yes,menubar=no,copyhistory=no');
        }

        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          Subic - I answered your comment from my blog - did you get a chance to see it?
          David Williams
          Subic
          Basic Member
          Posts: 7
          Basic Member
            Dave,

            No. I haven't looked yet. Let me check that. Thank you.
            Subic
            Basic Member
            Posts: 7
            Basic Member
              Dave,

              I have looked your comment and replied on your blog.

              I don't have any drop down to get the row id. Suggest me for any other idea.
              David Williams
              Veteran Member
              Posts: 1127
              Veteran Member
                You can add an extra drop down select value to the FC and if you use that (like in my sample on my blog) then the script will work.
                David Williams
                Subic
                Basic Member
                Posts: 7
                Basic Member
                  Dave,

                  Are you saying, add a drop down to each invoice row for getting the row info?.
                  Subic
                  Basic Member
                  Posts: 7
                  Basic Member
                    Anyone have another idea?.
                    isln_boy
                    Basic Member
                    Posts: 8
                    Basic Member
                      For the button option, I was getting the same response as you were, always returning the the first row value. I fixed the problem by manually adding "r0" to the end of nbr variable for the button in the source.

                      Changed this

                      push id="push3" nbr="_l80"

                      to

                      push id="push3" nbr="_l80r0"
                      TracyO
                      Veteran Member
                      Posts: 97
                      Veteran Member
                        I remembered now that we had to go to the source page in DS to make it read the line we wanted. We had to change the actual Source to display the field for nbr:
                        I believe before we changed the source it read: nbr = ""
                        then we changed it to: nbr="_l72ro" (where l72 is the button I created.
                        Hope this helps
                        TracyO
                        Veteran Member
                        Posts: 97
                        Veteran Member
                          the code did not come thru. try this again: You should find the line in the source a few lines above where the java script code starts to display

                          Subic
                          Basic Member
                          Posts: 7
                          Basic Member
                            Yes. It is working, after changing the nbr field from "_67" to "_67r0". Thank you all.
                            Ragu Raghavan
                            Veteran Member
                            Posts: 469
                            Veteran Member
                              Thank you all. This helped me today.
                              You are not authorized to post a reply.