# Data type mismatch between SQL and Perspective table

**URL:** <https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 17, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173 "2019-10-17T18:41:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [October 17, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173/1 "2019-10-17T18:41:43Z")

</div>

Hello Forum.

I am trying to render the results of a SQL Query on a Perspective table. I authored a Named Query that returns a data set which includes a few “date” columns. Authoring shown below:

 ![NamedQuery](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cc515f3375af3625fdeca26666841347ca381f5a.png)

The results from the “Testing” tab show the columns returning in the correct format:

 ![NamedQuery%20Return](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f5bb5442af096ea884c10f2005d44ecd6d20674b.png)

However, when I bind the data of my Perspective table to the named query, the columns are not returned as “date” type. I tried changing props.column[xx].render from “auto” to “date.” That didn’t work.

 ![NamedQuery%20Perspective](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7b22876ce8e32a8e0f116f29dd92a9f96813ebe2.png)

Any ideas why the fields aren’t rendering correctly?

Thanks,  
M Murphy

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 17, 2019, 7:43pm UTC](https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173/2 "2019-10-17T19:43:46Z")

</div>

You haven’t set the `field` property for the column, and so the settings will not have any noticeable effect. set `Table.props.columns[7].field` to “CAL\_Due”.

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [October 17, 2019, 8:12pm UTC](https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173/3 "2019-10-17T20:12:21Z")

</div>

That did the trick! I guess I had assumed that “Add Array Element…” would have tied it’s index to the columns on the table.

Thanks for the quick response!  
M Murphy

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 17, 2019, 8:52pm UTC](https://forum.inductiveautomation.com/t/data-type-mismatch-between-sql-and-perspective-table/29173/4 "2019-10-17T20:52:09Z")

</div>

> [@mmurphy](#):
>
> I guess I had assumed that “Add Array Element…” would have tied it’s index to the columns on the table.

That's not safe to assume because there is every possibility that you actually want to re-order the columns based on some other information, or even omit some columns based on possible security restrictions for the user. From a default table placement with a data binding, when you add the first column element we default to showing... the first column - and this continues as you add each other column, but we don't apply any settings from the column object because you haven't actually specified which column the object defines.

It's a weird trade-off due to us not wanting to show no columns if you have column objects defined vs showing columns if you have NO columns defined.
