--- title: "Updating Displayed PDF on Upload" slug: "updating-displayed-pdf-on-upload" updated: 2021-08-30T20:47:56Z published: 2021-08-30T20:47:56Z canonical: "documentation.decisions.com/updating-displayed-pdf-on-upload" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Updating Displayed PDF on Upload Example Lab ArticleWhile Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released. --- ## Overview | ## Example Lab Details | | --- | | **Version** | 7.6.0 | | **Root Folder** | Example Lab - Updating Displayed PDF on Upload | | **Modules** | None | | **Dependencies** | None | This Example Lab demonstrates how to update a PDF shown in a Form's Document Viewer to show the most recent PDF uploaded. --- ## Explanation This example comprises of two Flows, a Folder of example PDFs, and a Defined Database Structure for storing PDFs. To start this example project, select the "Add Files to DB" Flow. This Flow prompts the end user to upload a File by listing the input "File_Added" with the FileData data type in the start step. Next, the **CreateDefinedEntity** step, named "Add PDF to Database" and found in **User Defined Types > Database Structures > PDF_DB > Create PDF_DB,** adds the uploaded PDF File to the specified database. Under Inputs, the Build Data input mapping type creates the "PDF" input shown in the screenshot below. To save the uploaded file, select the input mapping for "PDF" as Select From Flow then choose the "File_Added" input. When debugging the Flow, run the "Upload ExamplePDF1" unit test shown on the left column to use the provided materials. If running the Flow, please download the example PDFs found within the "ExamplePDFs" Folder and upload "ExamplePDF1". Close this Flow. Open and run the "Update on Upload" Flow. The **GetAllDefinedEntities** step, named "Get All PDF in Database", collects all PDFs stored to the specified database. The "Display New PDF" Form utilizes a **Document Viewer** tool to display a PDF in this case ExamplePDF1. To configure the Document Viewer, open the Form Editor, click the Document Viewer, and select it's input type as FileData and it's data name as "PDF DATA". After closing the Form Editor, click back on the Form to view it's inputs. Notice "PDF DATA"'s input mapping is Select From Flow to designate the **Results.All PDF.Last** pathing which displays only the most recently uploaded PDF to the end user. To prove this, exit this Flow and run the "Add Files to DB" again instead uploading the second provided file: ExamplePDF2. Now when the end user runs the "Update on Upload" Flow, they will see ExamplePDF2 since it is the most recently uploaded file. Reference Articles[Database Structure CRUD Actions](https://documentation.decisions.com/v7/docs/database-structure-crud-actions) [Document Viewer On Form](https://documentation.decisions.com/v7/docs/document-viewer-form) ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-08-30_12h45_53.png)![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-08-30_12h31_42.png) --- ## Project Download The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 7.6.0 or later using our [Importing/Exporting](https://documentation.decisions.com/docs/exporting-and-importing-overview) article. [ExampleLab[UpdatingDisplayedPDFOnUploadSample.].zip](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/ExampleLab%5BUpdatingDisplayedPDFOnUploadSample.%5D.zip) ---