# Please Help (Pdf Viewer)

**URL:** <https://forum.inductiveautomation.com/t/please-help-pdf-viewer/24450>\
**Category:** Ignition\
**Created:** [April 28, 2019, 8:37pm UTC](https://forum.inductiveautomation.com/t/please-help-pdf-viewer/24450 "2019-04-28T20:37:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcamp1](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dcamp1](https://forum.inductiveautomation.com/u/dcamp1)\
**Post date:** [April 28, 2019, 8:37pm UTC](https://forum.inductiveautomation.com/t/please-help-pdf-viewer/24450/1 "2019-04-28T20:37:07Z")

</div>

[Setting up to display pdf file into pdf viewer](https://docs.inductiveautomation.com/display/DOC79/Storing+Files+in+a+Database)

I have followed this to the letter but I continue to get a script error, and I can’t figure out why, I have worked on this till I am blue in the face.

‘’’  
`# Check to see if the property that changed was the Selected Value property.`

`if``event.propertyName` `=` `=``"selectedValue"` `:`

`` `# Run the query to grab the file name and bytes using the new selected ID value.`

`` `system.db.runNamedQuery(` `"Read File"` `, {` `"fileID"` `:event.newValue})`

`` `# Grab the file bytes and name from the same row.`

`` `bytes` `=``data.getValueAt(` `0` `,` `"filebyte"` `)`(This is my error “data” is not defined!! )

`` `name` `=``data.getValueAt(` `0` `,` `"fileName"` `)`

`` `# Load the bytes into the PDF Viewer component.`

`` `event.source.parent.getComponent(` `'PDF Viewer'` `).loadPDFBytes(bytes, name)`  
‘’’

---

<div class="post-metadata">

**Author:** ![Kurt.Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kurt.larson/32/6426_2.png) [@Kurt.Larson](https://forum.inductiveautomation.com/u/Kurt.Larson)\
**Post date:** [April 28, 2019, 8:51pm UTC](https://forum.inductiveautomation.com/t/please-help-pdf-viewer/24450/2 "2019-04-28T20:51:41Z")

</div>

You need to store the results of the named query into the `data` object. So `data = system.db.runNamedQuery(``"Read File"``, {``"fileID"``:event.newValue})`

---

<div class="post-metadata">

**Author:** ![dcamp1](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dcamp1](https://forum.inductiveautomation.com/u/dcamp1)\
**Post date:** [April 28, 2019, 10:06pm UTC](https://forum.inductiveautomation.com/t/please-help-pdf-viewer/24450/3 "2019-04-28T22:06:22Z")

</div>

Thanks for the help, I finally got some of my other problems worked out also.

I was have several issues that was causing me to pull my hair out, once I got the “Firewall” issue figured out the rest of it started coming coming together.
