Any ideas?

 10 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
wilcoxmad
Veteran Member
Posts: 87
Veteran Member

    I have a form that allows the users to select an applicant with a push button. The form then sends the user to an HR11 clone with the company and SSN. The default form for the GH11 looks for an inquire function with out an employee number. It then does an applicant lookup by ssn.

    The problem is that the passed data is not getting to the second form. When I do an alert on the SSN for the second form, it is blank.

    Here is the code from the two forms.

     
     
    FORM   1  -----
                    if (id == "push1")
                    {
                    var vCompany=lawForm.getFormValue("text1");
                    var vSSN = lawForm.getFormValue("text3");
     
                    //Send HR11EZ via GH11.1
                    var s = top.AGSPath + "?_PDL=";
                    s += portalWnd.oUserProfile.getAttribute("ProductLine");
                    s += "&_TKN=GH11.1&LFN=ALL&_RTN=DATA&_TDS=IGNORE&_OUT=XML&_EVT=CHG&_FC=I";
                    s += "&EMP-COMPANY=" + vCompany;
                    s += "&EMP-FICA-NBR=" + vSSN;
                    s += "&_EOT=TRUE";
     
                    //Send API to the server
                    portalWnd.httpRequest(s);
                   
                    return true;
                   
                    }             
     
    FORM   2  -----
     
    //vSSN = lawForm.getFormValue("text171");
                    vSSN = lawForm.getDataValue("EMP-FICA-NBR");
     
                    alert (vSSN)
    Derek Czarny
    Veteran Member
    Posts: 63
    Veteran Member
      I am not exactly sure what you are trying to do, but I believe I did something similar. On my (GH11.1) form I have a lookup box and a button. The lookup box is on the data element Employee-App-Number. The code for the button is below.

      function LookUpPosition()
      {
      var vPosition = lawForm.getFormValue("text25");
      var sProd = portalWnd.oUserProfile.getAttribute("ProductLine");
      var vDMEInfo = portalWnd.httpRequest(portalWnd.DMEPath + "?_PDL=" + sProd + "&FILE=PAPOSITION&FIELD=COMPANY;DEPARTMENT;END%2DDATE;EXEMPT%2DEMP;JOB%2DCODE;PROCESS%2DLEVEL;SALARY%2DCLASS;SUPERVISOR;OT%2DPLAN%2DCODE&SELECT=POSITION%3D" + vPosition + "%20%26END%2DDATE%3D&OUT=XML");

      var vObjDMEXML = new portalWnd.DataStorage(vDMEInfo);
      var vRecords = vObjDMEXML.document.getElementsByTagName("RECORD");
      var vColumns = new Array()
      var vColumns = getDMEColumnIndex(vObjDMEXML.document.getElementsByTagName("COLUMN"));

      var vCount = vObjDMEXML.document.getElementsByTagName("RECORDS");
      var vRC = vCount[0].getAttribute("count")

      if (vRC >= 2)
      {
      alert("There are duplicate position numbers that are active.")
      return false;
      }
      if (vRC == 1)
      { var vCols = vRecords[0].getElementsByTagName("COL");
      var vDepartment = getNodeValue(vCols[vColumns["DEPARTMENT"]])
      var vProcessLevel = getNodeValue(vCols[vColumns["PROCESS-LEVEL"]])
      var vJobCode = getNodeValue(vCols[vColumns["JOB-CODE"]])
      var vSalaryClass = getNodeValue(vCols[vColumns["SALARY-CLASS"]])
      var vSupervisor = getNodeValue(vCols[vColumns["SUPERVISOR"]])
      var vExempt = getNodeValue(vCols[vColumns["EXEMPT-EMP"]])
      var vOTPlanCode = getNodeValue(vCols[vColumns["OT-PLAN-CODE"]])


      lawForm.setFormValue("text22","");
      lawForm.setFormValue("text21","");
      lawForm.setFormValue("text26","");
      lawForm.setFormValue("select1","");
      lawForm.setFormValue("text27","");
      lawForm.setFormValue("select4","");
      lawForm.setFormValue("text40","");

      lawForm.setFormValue("text22",vDepartment);
      lawForm.setFormValue("text21",vProcessLevel);
      lawForm.setFormValue("text26",vJobCode);
      lawForm.setFormValue("text27",vSupervisor);

      if (lawForm.getFormValue("text12")=="A3")
      {
      lawForm.setFormValue("select1","H");
      lawForm.setFormValue("select4","N");
      lawForm.setFormValue("text40","NONE");
      }
      else
      {
      lawForm.setFormValue("select1",vSalaryClass);
      lawForm.setFormValue("select4",vExempt);
      lawForm.setFormValue("text40",vOTPlanCode);
      }

      return true;
      }

      return true;

      }
      Derek Czarny
      Veteran Member
      Posts: 63
      Veteran Member
        Sorry, I posted the wrong code for that button. That code was for a position lookup button. This is the applicant inquire code.


        function SearchForApplicant()
        {
        if(vApplicantNbr!="")
        {
        var vApplicantNbr = lawForm.getFormValue("hidden317")
        var vEmployeeNbr = lawForm.getFormValue("text2")
        var sCompany = lawForm.getDataValue("EMP-COMPANY")
        var sProd = portalWnd.oUserProfile.getAttribute("ProductLine");
        ClearAllForm();


        var vDMEInfo = portalWnd.httpRequest(portalWnd.DMEPath + "?_PDL=" + sProd + "&FILE=APPLICANT&FIELD=APPLICANT;LAST_NAME;FIRST_NAME;MIDDLE_NAME;PROCESS_LEVEL;FICA_NBR;BIRTHDATE;NBR_FTE;HM_PHONE_CNTRY;HM_PHONE_NBR;ADDR1;CITY;STATE;ZIP;EEO_CLASS;SEX;HIRE-SOURCE;REQUISITIONS.REQUISITION&SELECT=APPLICANT%3D" + vApplicantNbr + "&OUT=XML");
        {var vObjDMEXML = new portalWnd.DataStorage(vDMEInfo);
        var vRecords = vObjDMEXML.document.getElementsByTagName("RECORD");
        var vColumns = new Array()
        var vColumns = getDMEColumnIndex(vObjDMEXML.document.getElementsByTagName("COLUMN"));

        var vCount = vObjDMEXML.document.getElementsByTagName("RECORDS");
        var vRC = vCount[0].getAttribute("count")
        if (vRC == 0)
        {
        alert("The applicant that you are trying to search for does not exist.")
        return false;
        }
        if (vRC >= 2)
        {
        alert("That is impossible! There are duplicate applicant numbers.")
        return false;
        }
        if (vRC == 1)
        { var vCols = vRecords[0].getElementsByTagName("COL");

        var vLastName = getNodeValue(vCols[vColumns["LAST-NAME"]])
        var vFirstName = getNodeValue(vCols[vColumns["FIRST-NAME"]])
        var vMiddleName = getNodeValue(vCols[vColumns["MIDDLE-NAME"]])
        var vFicaNbr = getNodeValue(vCols[vColumns["FICA-NBR"]])
        var vBirthDate = getNodeValue(vCols[vColumns["BIRTHDATE"]])
        var vNbrFte = getNodeValue(vCols[vColumns["NBR-FTE"]])
        if(vFicaNbr != "")
        {
        if (vFicaNbr.substr(0,1) != "0")
        {var vBadgeNbr = vFicaNbr.substr(0,3) + vFicaNbr.substr(4,2) + vFicaNbr.substr(7,4) + "1"
        lawForm.setFormValue("text54",vBadgeNbr)
        }
        else
        {var vBadgeNbr = "1" + vFicaNbr.substr(1,2) + vFicaNbr.substr(4,2) + vFicaNbr.substr(7,4) + "1"
        lawForm.setFormValue("text54",vBadgeNbr)
        }
        }
        else
        {var vBadgeNbr = ""}
        var vHmPhoneCntry = getNodeValue(vCols[vColumns["HM-PHONE-CNTRY"]])
        var vHmPhoneNbr = getNodeValue(vCols[vColumns["HM-PHONE-NBR"]])
        var vAddr1 = getNodeValue(vCols[vColumns["ADDR1"]])
        var vCity = getNodeValue(vCols[vColumns["CITY"]])
        var vState = getNodeValue(vCols[vColumns["STATE"]])
        var vZip = getNodeValue(vCols[vColumns["ZIP"]])
        var vEthnicity = getNodeValue(vCols[vColumns["EEO-CLASS"]])
        var vGender = getNodeValue(vCols[vColumns["SEX"]])
        var vHireSource = getNodeValue(vCols[vColumns["HIRE-SOURCE"]])
        var vRequisition = getNodeValue(vCols[vColumns["REQUISITIONS.REQUISITION"]])

        if(vRequisition != "")
        {
        //Getting the Requisition description and position information
        var vDMEReq = portalWnd.httpRequest(portalWnd.DMEPath + "?_PDL=" + sProd + "&FILE=PAJOBREQ&FIELD=DESCRIPTION;PROCESS_LEVEL;DEPARTMENT;JOB_CODE;LOCAT_CODE;POSITION;SUPERVISOR&SELECT=REQUISITION%3D" + vRequisition + "&OUT=XML");
        var vDMEReqOBJ = new portalWnd.DataStorage(vDMEReq);
        var vRecordsReq = vDMEReqOBJ.document.getElementsByTagName("RECORD");
        var vCountReq = vDMEReqOBJ.document.getElementsByTagName("RECORDS");
        var vRCReq = vCountReq[0].getAttribute("count")
        var vColumnsReq = new Array()
        var vColumnsReq = getDMEColumnIndex(vDMEReqOBJ.document.getElementsByTagName("COLUMN"));


        if (vRCReq == 1)
        {
        var vColsReq = vRecordsReq[0].getElementsByTagName("COL");
        var vReqDescription = getNodeValue(vColsReq[vColumnsReq["DESCRIPTION"]])
        var vProcLev = getNodeValue(vColsReq[vColumnsReq["PROCESS-LEVEL"]])
        var vDepartment = getNodeValue(vColsReq[vColumnsReq["DEPARTMENT"]])
        var vPosition = getNodeValue(vColsReq[vColumnsReq["POSITION"]])
        var vJobCode = getNodeValue(vColsReq[vColumnsReq["JOB-CODE"]])
        var vLocatCode = getNodeValue(vColsReq[vColumnsReq["LOCAT-CODE"]])
        var vSupervisor = getNodeValue(vColsReq[vColumnsReq["SUPERVISOR"]])


        lawForm.setFormValue("text22",vDepartment);
        lawForm.setFormValue("text25",vPosition);
        lawForm.setFormValue("text26",vJobCode);
        lawForm.setFormValue("text29",vLocatCode);
        lawForm.setFormValue("text21",vProcLev);
        lawForm.setFormValue("text135",vReqDescription);
        lawForm.setFormValue("text27",vSupervisor);
        }
        }

        lawForm.setFormValue("hidden317",vApplicantNbr)
        lawForm.setFormValue("text5",vLastName);
        lawForm.setFormValue("text7",vFirstName);
        lawForm.setFormValue("text9",vMiddleName);
        lawForm.setFormValue("text11",vFicaNbr);
        lawForm.setFormValue("text54",vBadgeNbr)
        lawForm.setFormValue("text61",vBirthDate);
        lawForm.setFormValue("text93",vHmPhoneCntry);
        lawForm.setFormValue("text94",vHmPhoneNbr);
        lawForm.setFormValue("hidden329",vAddr1);
        lawForm.setFormValue("hidden330",vCity);
        lawForm.setFormValue("hidden331",vState);
        lawForm.setFormValue("hidden332",vZip);
        lawForm.setFormValue("text71",vEthnicity);
        lawForm.setFormValue("select11",vGender);
        SetForm();

        lawForm.setFormValue("text60",vHireSource);
        //lawForm.setFormValue("text39",vNbrFte);

        if (vPosition != "")
        LookUpPosition()

        return true;
        }

        return true;
        }
        return true;
        }

        else
        alert("Please select an Applicant from the drop down list!")
        return true;
        }
        wilcoxmad
        Veteran Member
        Posts: 87
        Veteran Member

          Derek,

          Thank you for the reply. That is similar to what I am doing, except I want to look up the applicant that is selected on one form and display his data on another.
          When the user clicks on the button from form one, i want to pass the SSN to form two and look up the data for that SSN on form two.
          For some reason the SSN is not making it to the second form, it's always blank. That is what I'm hoping someone here can help me with.

          Thanks, Mark.

          David Williams
          Veteran Member
          Posts: 1127
          Veteran Member
            I'm not familiar with these forms - is the SS# a key field on your 2nd form? You could use the HK feature of your form call if SS is a key field when opening that form.
            David Williams
            Terry P
            Veteran Member
            Posts: 234
            Veteran Member
              Mark - I think you need to change the string on your call. If you're passing variables it needs to have a "?" before the name. Then I think (and not sure cause I have not tested it), but then use the getVarFromString Global function.

              Here is the example from the Objects Viewer:

              getVarFromString Global function
              Returns [string]

              Parameters
              varName [string] - variable name to search for
              str [string] - string to search


              Remarks
              Use this method to extract ? and & separated string parameters. The method
              allows for (ignores) the presence of an underscore (_) preceeding varName and
              the match is not case sensitive.

              This method is useful for retrieving parameter values from a URL query string.

              Example
              The following examples assume a browser URL of:
              'http://server.domain.com:80/lawson/portal/?_TKN=CU01.1

              var str = portalWnd.getVarFromString("_TKN",portalWnd.document.location);
              portalWnd.cmnDlg.messageBox(str); // displays 'CU01.1"

              var str = portalWnd.getVarFromString("tkn",portalWnd.document.location);
              portalWnd.cmnDlg.messageBox(str); // also displays 'CU01.1"

              Terry P
              Veteran Member
              Posts: 234
              Veteran Member
                So in your calling program change it to this:

                //Send HR11EZ via GH11.1
                var s = top.AGSPath + "?_PDL=";
                s += portalWnd.oUserProfile.getAttribute("ProductLine");
                s += "&_TKN=GH11.1&LFN=ALL&_RTN=DATA&_TDS=IGNORE&_OUT=XML&_EVT=CHG&_FC=I";
                s += "?EMP-COMPANY=" + vCompany;
                s += "?EMP-FICA-NBR=" + vSSN;
                s += "&_EOT=TRUE";


                Then in your called program add the code to get the values passed.
                wilcoxmad
                Veteran Member
                Posts: 87
                Veteran Member

                  Terry,

                  I changed the sending form to this: ---

                   //Send HR11EZ via GH11.1
                   var s = top.AGSPath + "/?_PDL=";
                   s += portalWnd.oUserProfile.getAttribute("ProductLine");
                   s += "&_TKN=GH11.1&LFN=ALL&_RTN=DATA&_TDS=IGNORE&_OUT=XML&_EVT=CHG&_FC=I";
                   s += "&EMP-COMPANY=" + vCompany;
                   s += "&FICA=" + vSSN;
                   s += "&_EOT=TRUE";
                   //DisplayImageWeb();

                   alert(s);
                   //Send API to the server
                   portalWnd.httpRequest(s);

                  And the receiving form to this: ----

                  var sMsg = portalWnd.getVarFromString("pdl",portalWnd.document.location);
                  portalWnd.cmnDlg.messageBox(sMsg);

                  I did try the ? - didn't work either.

                  Still getting blanks. I used pdl as a last resort, trying to get anything to display.

                   

                   

                  wilcoxmad
                  Veteran Member
                  Posts: 87
                  Veteran Member
                    David,

                    yes the SSN is a key for looking up the applicant, in our home grown system.

                    It is not a HK on the HR11 form, which is the COBOL behind this new form..

                    How do I use the HK feature? Can you show me an example?

                    Thanks, Mark.
                    David Williams
                    Veteran Member
                    Posts: 1127
                    Veteran Member
                      For opening a PO20 screen (for example) you need Company and PO Number before you can perform an Inquire.
                      So the call to open that form looks like:
                      server:port/lawson/portal/index.htm?_PDL=PROD&_TKN=PO20.1&_HK=100012345678 (with company = 1000 and PO = 12345678)

                      You would assign the URL to a variable and call that variable to open your new form.
                      You might want the Inquire to be the initial action on the new form when initiated.
                      David Williams
                      wilcoxmad
                      Veteran Member
                      Posts: 87
                      Veteran Member
                        Well thanks all for your excellent input. I was finally able to get this thing working!

                        Here is how I had to do the send:
                        if (id == "push2")
                        {
                        var vCompany=lawForm.getFormValue("text1");
                        var vSSN = lawForm.getFormValue("text4");

                        //Send HR11EZ via GH11.1

                        var sURL= portalObj.path+"?_TKN=GH11.1&_EMP-COMPANY="+
                        vCompany+"&_EMP-FICA-NBR="+vSSN+"&_HK="+vSSN;

                        window.open(sURL);

                        return true;

                        }

                        Here is the receiving form:
                        function SSNINQ()
                        {
                        //********* Lookup applicant stuff here.

                        var vSSN = portalWnd.getVarFromString
                        ("EMP-FICA-NBR",portalWnd.document.location);
                        //portalWnd.cmnDlg.messageBox(vSSN);

                        if (vSSN == "") return;

                        var vCompany = portalWnd.getVarFromString
                        ("EMP-COMPANY",portalWnd.document.location);
                        //portalWnd.cmnDlg.messageBox(vCompany);

                        From here I was able to read the table and populate the form fields.

                        Thanks Again!!!