I need an example of home-made javascript DMEObj for Self-service centers

 4 Replies
 0 Subscribed to this topic
 68 Subscribed to this forum
Sort:
Author
Messages
Mike Schlenk
Veteran Member
Posts: 71
Veteran Member
    In an attempt to supplement self-service centers, I'm looking to create my own htm files that authenticate, create a DME call and display data.

    I'm trying to learn from recsum.htm and paytyear.htm and I'm having problems. The issue is when I make a call that returns multiple records, then I want to display each field in a table.

    Can someone please help? I'm so close, I know I'm just not understanding something about the DMEObject and how to use Arrays to store the records.

    Any help would be appreciated.
    ridjayc
    Veteran Member
    Posts: 191
    Veteran Member
      Here is an example. The XXREQNOTES is a custom view. It lets us view note data in a simple way. There some special javascript call to get the notes but I didn't want to spend several days figuring it out so I did this view and used DME on it.

      Oh one other little gotcha, if memory serves me, is that if you do change execs for process flow viewing they for some reason need to have the "...recsum.." in the file name.

      On a related topic if you would like to do views and have it availbe in Lawson there is a document on Lawson on how to do it in Oracle. We are on SQL server here but the process is very simular. If your DBAs are very difficult to work with then I would skip the views and just try to work around it. Also view creation can require you to bounce Lawson.

      --JayR

      //Functions-------------------------------------------------------------------------------------------

      /************************************************************
      Function: LoadCatcher

      Purpose: Driver function called by frameset onLoad event driver

      ************************************************************/
      function LoadCatcher()
      {
      GetMessages()
      clearTimeout(LoadTimer);
      }


      /************************************************************
      Function: GetMessages

      Purpose: Get Account Information

      ************************************************************/
      function GetMessages()
      {
      //alert("GOT HERE")

      var logancall = new DMEObject(prodline, "XXREQNOTES")
      logancall.out = "JAVASCRIPT"
      logancall.field ="note-name;modified-user;create-user;object1;object2;object-type"
      logancall.select = "company=" + m_Company + "&req-number=" + m_ReqNumber + "&line-nbr=" + m_LineNbr
      logancall.func = "displayNotes()"
      DME(logancall, "PRODLINE")
      PRODLINEwin = self.PRODLINE
      }

      /************************************************************
      Function: displayNotes

      Purpose: Display the Requisition summary info via HTML

      ************************************************************/
      function displayNotes()
      {
      //alert("START display")

      var str = '' + ''
      + ''
      var TableBorder = HtmlTableBorder
      var TableBgColor = HtmlTableBgColor
      var ThBgColor = HtmlThBgColor

      str = ''
      + ''
      + ''
      + ''
      + ''
      + ''
      + ''
      + ''


      // This next section of code is to group notes that are alike together.
      var type_array = new Array();
      var i = 0
      var max_spin = 0
      PRODLINEwin.record.sort(note_sort)
      type_array[i] = '[' + strNoteType(PRODLINEwin.record[i].object_type) + ']'
      while(i + 1 < PRODLINEwin.NbrRecs && max_spin < 100)
      {
      max_spin++

      type_array[i] = '[' + strNoteType(PRODLINEwin.record[i].object_type) + ']'
      type_array[i+1] = '[' + strNoteType(PRODLINEwin.record[i+1].object_type) + ']'
      var c1 = PRODLINEwin.record[i].note_name + PRODLINEwin.record[i].create_user + PRODLINEwin.record[i].modified_user + PRODLINEwin.record[i].object1 + PRODLINEwin.record[i].object2
      var c2 = PRODLINEwin.record[i+1].note_name + PRODLINEwin.record[i+1].create_user + PRODLINEwin.record[i+1].modified_user + PRODLINEwin.record[i+1].object1 + PRODLINEwin.record[i+1].object2
      if(c1 == c2) //Basically if truee then notes are the same and will be grouped
      {
      type_array[i] += '
      ' + type_array[i+1]
      PRODLINEwin.record.splice(i+1,1)
      PRODLINEwin.NbrRecs--
      type_array.splice(i+1,1)
      continue
      }
      i++
      }


      for(var i=0;i< PRODLINEwin.NbrRecs;i++)
      {

      //logancall.field ="note-name;modified_user;object1;object2;object-type"
      var note_name = PRODLINEwin.record[i].note_name
      var note_type = type_array[i]
      var created_by = strCleanUser(PRODLINEwin.record[i].create_user)
      var modified_by = strCleanUser(PRODLINEwin.record[i].modified_user)
      var comment = PRODLINEwin.record[i].object1 + PRODLINEwin.record[i].object2
      comment = comment.replace(/EOL/g,'
      ')

      str += ''
      + ''
      + ''
      + ''
      + ''
      + ''
      + ''
      }
      str += '
      ' + 'Note Name' + '' + 'Note Type' + '' + 'Created By' + '' + 'Modified By' + '' + 'Comments' + '
      ' + PRODLINEwin.record[i].note_name + '' + note_type + '' + created_by + '' + modified_by + '' + comment + '

      '
      + ''

      mainFrame1.document.write(str)
      mainFrame1.document.close()

      }

      function note_sort(a,b)
      {
      var c1 = a.note_name + a.create_user + a.modified_user + a.object1 + a.object2
      var c2 = b.note_name + b.create_user + b.modified_user + b.object1 + b.object2
      if(a>b) return 1
      if(a==b) return 0
      else return -1
      }

      function strCleanUser(strIn)
      {
      var str = strIn
      str = str.replace('BCI-CORP\\','')
      return str
      }

      function strNoteType(strIn)
      {
      switch(strIn)
      {
      case 'O':
      return 'Display Only'
      case 'R':
      return 'Receiving'
      case 'L':
      return 'Pick Lists'
      case 'D':
      return 'Delivery'
      case 'P':
      return 'PO'
      case 'Q':
      return 'Requisitions'
      case 'I':
      return 'Internal'
      default :
      return strIn
      }
      }
      //-->



      ridjayc
      Veteran Member
      Posts: 191
      Veteran Member
        Sorry I wanted to do an attachment but it didn't take it for some reason. If that comes through a little mangled let me know and I will email it.
        John Henley
        Posts: 3353
          Another example to look at is ESS dependents. Look at dependlist.htm and depinfo.js. They have all the functionality you are looking for....
          Thanks for using the LawsonGuru.com forums!
          John
          Mike Schlenk
          Veteran Member
          Posts: 71
          Veteran Member

            Thank you.  I'm going to work on this.  I'm basically trying to make a DME call and display for emtatrans data for each employee.  I want to show time accrual data per pay period.  Any ideas here would be great.

            I can work from your text here, thank you.