# Error writing from DB to PDF Viewer Vision

**URL:** <https://forum.inductiveautomation.com/t/error-writing-from-db-to-pdf-viewer-vision/88432>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [April 5, 2024, 2:56pm UTC](https://forum.inductiveautomation.com/t/error-writing-from-db-to-pdf-viewer-vision/88432 "2024-04-05T14:56:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Why\_Me](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Why\_Me](https://forum.inductiveautomation.com/u/Why_Me)\
**Post date:** [April 5, 2024, 2:56pm UTC](https://forum.inductiveautomation.com/t/error-writing-from-db-to-pdf-viewer-vision/88432/1 "2024-04-05T14:56:33Z")

</div>

I get the following error when clicking my button which should run my named query as per ignition documentation to pull from my blob server which stores my pdfs. trying to then write to the pdf viewer but error in line which starts with "bytes = "

I previously had it as per documentation without db.data but that didnt work either

gave this error: NameError: name 'data' is not defined

Any ideas?

File "event:actionPerformed", line 27, in   
AttributeError: write-only attr: data

```auto
var = system.tag.readBlocking("[default]SQL Edit/filename")[0].value    
parameters = {"filename":var}
db = system.db.runNamedQuery("RetrievePDF", parameters)

# Grab the file bytes and name from the same row.
bytes = db.data.getValueAt(0, "Content")
name = db.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:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 5, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/error-writing-from-db-to-pdf-viewer-vision/88432/2 "2024-04-05T14:57:59Z")

</div>

Why is there `.data` in those lines at all? Should be just `db.getValueAt(....)`

---

<div class="post-metadata">

**Author:** ![Why\_Me](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Why\_Me](https://forum.inductiveautomation.com/u/Why_Me)\
**Post date:** [April 5, 2024, 2:59pm UTC](https://forum.inductiveautomation.com/t/error-writing-from-db-to-pdf-viewer-vision/88432/3 "2024-04-05T14:59:44Z")

</div>

something i miscopied from the ignition documentation.

thank you, humbled.
