# Question on Table Data Query

**URL:** <https://forum.inductiveautomation.com/t/question-on-table-data-query/68172>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [January 3, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172 "2023-01-03T15:30:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [January 3, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/1 "2023-01-03T15:30:31Z")

</div>

Good morning Team,

I have created a button in a view that is used to put our system cranes in/out of manual mode.

I created a named query that is used to update the table for a boolean result with a very simple query.

This query/button work great. The problem is that on occasion the button is not synced with the table.

I decided to write a query to return the boolean value from the table and bind that to the button text using scalar result.

My issue is that i cannot transform the scalar value into a string value.

Question:

1. Is this the best way to make sure the button is updated to the correct state when the page is opened?
2. Is there a way to transform the scalar vaule?

```auto
UPDATE storage
SET data = :dataValue 
WHERE attribute = 'auto-picking'

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/7330d4f228f9181510db58f0215a1e753f290476.png)

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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 3, 2023, 3:43pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/2 "2023-01-03T15:43:24Z")

</div>

I think a [map transform](https://docs.inductiveautomation.com/display/DOC81/Map+Transform#MapTransform-IntegertoString) is what you're looking for.

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [January 3, 2023, 3:47pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/3 "2023-01-03T15:47:39Z")

</div>

I was using the map transform but it would not transform the scalar.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d27cc793aba155b0e866b37069873c99d6e2357c.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 3, 2023, 4:58pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/4 "2023-01-03T16:58:41Z")

</div>

I did not have a problem using the map, but you could also use an expression transform  
`toBoolean({value})`

- or -

You could chang ethe data type of the table column to boolean and forego the transform altogether.

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [January 3, 2023, 5:03pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/5 "2023-01-03T17:03:59Z")

</div>

Great idea, unfortunatly i will need the transform. The author of the table has the filed as VARCHAR(45) with string data in it as well as boolean.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 3, 2023, 5:25pm UTC](https://forum.inductiveautomation.com/t/question-on-table-data-query/68172/6 "2023-01-03T17:25:40Z")

</div>

Varchar, eh? Try putting quotes around the 1 and 0.

We can skip the choice words I have for the author. 😉
