Attaching Files in MAP Application

You can attach files from local drive (device folders) or from any configured cloud Provider repository, such as GoogleDrive, Oracle Document Cloud and so forth. On the MAP layout, the file attachment will be defined in HTML page element.

To attach files in MAP application:

  1. Insert an HTML element in the MAP layout.

  2. In Application Designer, create an HTML definition that includes an iframe to the required PIA page which has the attachment functionality.

    The attachment takes place in the PIA Page using File Attachment APIs.

    This is an example of the html area.

    html>
    <body>
    <h1></h1>
    <p></p>
    
    <iframe id="mapAttachPIAPage" type="text/html" src="ABC/EMPLOYEE/QEDMO/c/QE_FP.QE_TESTUTIL.GBL" scrolling=auto style="width: 800px; height: 594px;"></iframe>
    </iframe>
    </body>
    </html>
  3. Use PeopleCode application class to dynamically load the HTML in MAP Layout.

    This is an example of the OnInitEvent for the MAP layout, which will load the HTML page, you will need to add code to retrieve the web server information to update the HTTP URL.

    method OnInitEvent
       /+ &Map as Map +/
       /+ Returns Map +/
       
       Local Compound &CUSTCOM, &COM, &URICOM, &COM2, &COM1;
       Local Document &Document, &CustDocument, &URIDocument, &DOC2, &DOC1;
       Local MapPage &Page;
       Local MapElement &Element;
       Local MapElement &ElementHeader, &ElementFooter;
       Local boolean &bRet;
       Local integer &i = 1;
       Local Primitive &one;
       Local Message &MSG, &RETMSG;
      
       &Document = &Map.GetDocument();
       &COM = &Document.DocumentElement;
     
       &URIDocument = &Map.GetURIDocument();
       &URICOM = &URIDocument.DocumentElement;
         
       Local string &str = GetHTMLText(HTML.QE_MAP_ATTACH);
       
       /* Update the HTML for the current env from above string*/
       /* create the code to retrieve web server and update &newstr with the HTTP URL */
      
       Local string &newstr = Substitute(&str, "ABC", &server);
       
       &CustDocument = &Map.GetCustDocument();
       &CUSTCOM = &CustDocument.DocumentElement;
       &CUSTCOM.GetPropertyByName("prim01").value = &newstr;
       
       Return &Map;
    end-method;
  4. View the attached file or any uploaded file in MAP using MAP Ajax event and getAttachmentURL functionality.

    This is an example of PeopleCode with getAttachmentURL:

    method OnAjaxEvent
       /+ &Map as Map +/
       /+ Returns Map +/
       
       Local Collection &DEMO_COLL, &COLL_ONE;
       Local Compound &DEMO_COMP, &COM, &URICOM, &CUSTCOM;
       Local Document &CustDocument, &Document, &URIDocument;
       Local MapPage &Page, &CustPage;
       Local MapElement &Element, &CustElement;
       Local MapElement &ElementHeader, &ElementFooter;
       Local Rowset &RS_EMPLOYEE;
       Local boolean &bRet;
       Local integer &i = 1;
       Local Primitive &one;
       
       &Document = &Map.GetCustDocument();
       &COM = &Document.DocumentElement;
       
       Local integer &RETCODE;
       Local string &URL_ID;
       Local string &ATTACHSYSFILENAME;
       Local string &ATTACHUSERFILE;
       Local string &ATTACHMENTURL;
       Local string &AUTHTOKEN;
       
       &URL_ID = "record://PSFILE_ATTDET";
       
       /*
       &ATTACHSYSFILENAME = &COM.GetPropertyByName("QE_PO_REF").Value;
       &ATTACHUSERFILE = &COM.GetPropertyByName("QE_PO_REF").Value;
       */
       
       &ATTACHSYSFILENAME = &Map.GetAJAXValueByName("mykey");
       &ATTACHUSERFILE = &Map.GetAJAXValueByName("mykey");
       
       
       &AUTHTOKEN = &Map.GetAuthToken();
       &RETCODE = GetAttachmentURL(&URL_ID, &ATTACHSYSFILENAME, &ATTACHUSERFILE, &ATTACHMENTURL, &AUTHTOKEN);
       
       &COM.GetPropertyByName("prim02").Value = &ATTACHMENTURL;
       
       Return &Map;

This is an example of the section of the MAP layout showing the HTML Area.

Image: MAP Layout with HTML area to launch the PIA page

This example illustrates the section of the MAP layout that contains the HTML area. It is in the Employee Photo container.

MAP Layout with HTML area to launch the PIA page

This is an example of the MAP application when the user selects the Select Photo button and then Attach.

Image: MAP application displaying File Attachment page

This example illustrates the MAP application when the user clicks the Select Photo button it will open the PIA page for file attachment. When user clicks Attach button, the file attachment page opens.

MAP application displaying File Attachment page