# Query from Vision 7.9 to Perspective 8.1

**URL:** <https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961>\
**Category:** Ignition\
**Tags:** ignition81, vision, perspective\
**Created:** [April 17, 2024, 7:13am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961 "2024-04-17T07:13:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 17, 2024, 7:13am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/1 "2024-04-17T07:13:57Z")

</div>

I´m converting a query from older 7.9 Vision proyect into a Named Querie to use it in a 8.1 perspective table. But I getting this error when i try to use the Named Querie on my table  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f1a32aa563dcbd74fa57fac70da3c3e2fc3447f.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 17, 2024, 8:46am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/2 "2024-04-17T08:46:16Z")

</div>

Is your binding just returning the word "array"?

Show us your binding. Post code using the \</\> button to format it.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 17, 2024, 8:56am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/3 "2024-04-17T08:56:19Z")

</div>

Hi, my binding is a query I transformer to Named Queries with Ignition

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf12bfeea56a9a9b7f4fc600042cc985be8fc64e.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/3088c8538bf25560630a794bea5e8db97883b169.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 17, 2024, 8:59am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/4 "2024-04-17T08:59:15Z")

</div>

> [@Transistor](#):
>
> Post code using the \</\> button to format it.

See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 17, 2024, 9:00am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/5 "2024-04-17T09:00:33Z")

</div>

SELECT \* FROM  
(  
SELECT WR.ASSET AS SEDE,  
(SELECT HAZARD FROM WORKREQUESTHAZARD WHERE COMPANY=WR.COMPANY AND WORKREQUEST=WR.WORKREQUEST ORDER BY CREATIONDATA FETCH FIRST ROW ONLY) AS HAZARD,  
(SELECT HAZARDVALUE FROM WORKREQUESTHAZARD WHERE COMPANY=WR.COMPANY AND WORKREQUEST=WR.WORKREQUEST ORDER BY CREATIONDATA FETCH FIRST ROW ONLY) AS HAZARDVALUE  
FROM WORKREQUEST WR LEFT JOIN WORKORDERWORKREQUEST WOWR ON WR.COMPANY=WOWR.COMPANY AND WR.WORKREQUEST=WOWR.WORKREQUEST  
WHERE WR.COMPANY = :PrismaCompany AND WR.REQUESTER='PRL' AND (WOWR.WORKORDER IS NULL  
OR (SELECT WORKORDERSTATE FROM WORKORDER WHERE COMPANY=WR.COMPANY AND WORKORDER=WOWR.WORKORDER) \< 60)  
)  
PIVOT (MAX(HAZARDVALUE) FOR HAZARD IN (:HazardList))  
ORDER BY SEDE

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 17, 2024, 9:04am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/6 "2024-04-17T09:04:55Z")

</div>

You didn't format the code! It's not difficult! See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

1. If you hover on the Error\_Exception message what do you see?
2. Are you using the same database engine?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [April 17, 2024, 10:15am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/7 "2024-04-17T10:15:45Z")

</div>

you have params in your query, but did not define any in your binding

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 17, 2024, 10:52am UTC](https://forum.inductiveautomation.com/t/query-from-vision-7-9-to-perspective-8-1/88961/8 "2024-04-17T10:52:15Z")

</div>

Ok, yes, I should define them with phyton as was done in the original proyect scripting. Still haven´t make it work but getting closer.  
I think the way to pass from 7.9 to 8.1 would be:

-Convert the querys to namedQuerys with Ignition tool  
-Add them to the new perspective tables  
-Convert the original scripting to phyton so I can add params to my new namedQuerys

thanks.
