# Client module with sql tag read?

**URL:** <https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699>\
**Category:** Module Development\
**Created:** [February 21, 2017, 4:56pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699 "2017-02-21T16:56:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 21, 2017, 4:56pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/1 "2017-02-21T16:56:51Z")

</div>

Hi,

I try to read sql tags in the client context of a module and I have the following error :  
com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Unable to locate function ‘SQLTags.read’

```
clientContext is memorized from the startup AbstractClientModuleHook.
The exposed function is used in a client script :

```

```auto
import system

liste = []
liste.append("testAlarme")
system.byes.utils.readTag("default",None,liste)
```

```auto
    @ScriptFunction(docBundlePrefix = "ClientScriptModule")
    public void readTag(
            @ScriptArg("source") String source,
            @ScriptArg("system") String system,
            @ScriptArg("pathParts") java.util.List<java.lang.String> pathParts) {
        try {
            List<TagPath> paths = new ArrayList<TagPath>();
            TagProp prop = TagProp.Value;
            paths.add(new BasicTagPath(source,system,pathParts,prop));

            java.util.List<QualifiedValue> qv = this.clientContext.getTagManager().read(paths);

            // une seule valeur prévue pour ce test
            logger.info("readTag return V : " + qv.get(0).getValue().toString());
            logger.info("readTag return T : " + qv.get(0).getTimestamp().toString());
            logger.info("readTag return Q : " + qv.get(0).getQuality().toString());

        } catch (Exception e) {
            logger.error(e.getMessage());
        }
    }
```

I don’t understand what I have missed ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 21, 2017, 5:09pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/2 "2017-02-21T17:09:11Z")

</div>

This looks like a bug on our end… perhaps one that’s been around for a while.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 21, 2017, 5:12pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/3 "2017-02-21T17:12:01Z")

</div>

As a workaround, you can use getTag() and then get the value attribute from the tag instead.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 21, 2017, 5:54pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/4 "2017-02-21T17:54:40Z")

</div>

Ok, in fact I was interested by the subscribe function of the sqltag manager in the client scope. read was just a first test. Does the subscribe function works ???

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 21, 2017, 6:29pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/5 "2017-02-21T18:29:33Z")

</div>

System. Tag. Read function is not based on these functions?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 21, 2017, 6:39pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/6 "2017-02-21T18:39:26Z")

</div>

Subscribing should work.

read() isn’t based on getting the attribute from the tag simply because it was missed in some long-ago refactoring, apparently. Our own system.tag.read function uses getTag() and gets the value attribute, which is why it was missed. There must not be any calls to the broken read function happening in client scope in our codebase.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 21, 2017, 7:21pm UTC](https://forum.inductiveautomation.com/t/client-module-with-sql-tag-read/12699/7 "2017-02-21T19:21:21Z")

</div>

Thanks a lot kevin for theses clarifications !
