# Synthax to write an internal db tag

**URL:** <https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331>\
**Category:** Module Development\
**Created:** [September 24, 2011, 10:08am UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331 "2011-09-24T10:08:06Z")\
**Posts on this page:** 5\
**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:** [September 24, 2011, 10:08am UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331/1 "2011-09-24T10:08:06Z")

</div>

I try to write an internal db tag,

```
            List<TagResult> writeResults;
            TagPath pathEcr = TagPathParser.parse("default","test");
            	          
            BasicWriteRequest wr = new BasicWriteRequest(pathEcr, "1");
            
            List<BasicWriteRequest> lwr = new ArrayList<BasicWriteRequest>(1);
            lwr.add(wr);
                        
            writeResults = context.getTagManager().write(lwr,null,true);

```

I can’t buid =\> The method write(List, AuthenticatedUser, boolean) in the type SQLTagsManager is not applicable for the arguments (List, null,  
boolean)

I try to user the TagWriteValueRequest, same message.  
Could you please provide me a write example?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 26, 2011, 4:48pm UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331/2 "2011-09-26T16:48:38Z")

</div>

Hi,

That error (as with all compile time errors) isn’t a problem with the SDK, but simply with your syntax.

In this case, you’re running into a little quirk of generics: the function wants the interface “WriteRequest”… and while you’re making a list of items that implment that interface, it doesn’t match the signature exactly. Instead of declaring the list as , you need to declare it simply as , even though you are, in fact, putting BasicWriteRequests in it.

That is:

`BasicWriteRequest wr = new BasicWriteRequest(pathEcr, "1");
List<WriteRequest> lwr = new ArrayList<BasicWriteRequest>(1);
lwr.add(wr);`

A bit confusing, perhaps, but unfortuately… that’s just Java.

---

<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:** [September 27, 2011, 7:19am UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331/3 "2011-09-27T07:19:35Z")

</div>

Hi,

I try to replace BasicWriteRequest with WriteRequest, but I can’t buid, i  
have the message : “Type mismatch: cannot convert from ArrayList to List\<ConnectionTableNIO.WriteRequest\>” on the line : BasicWriteRequest wr = new BasicWriteRequest(pathEcr, “1”);

List writeResults;  
TagPath pathEcr = TagPathParser.parse(“default”,“test”);  
BasicWriteRequest wr = new BasicWriteRequest(pathEcr, “1”);  
List lwr = new ArrayList(1);  
lwr.add(wr);  
writeResults = context.getTagManager().write(lwr,null,true);

☹ i miss something ???

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 27, 2011, 5:25pm UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331/4 "2011-09-27T17:25:14Z")

</div>

> [@](#):
>
> Type mismatch: cannot convert from ArrayList to List\<ConnectionTableNIO.WriteRequest\>

That's the wrong WriteRequest. Many things can have the same name, but will exist in different packages. In Eclipse, when you hit CTRL-Space and pick one, it will add an import statement for that package. In this case, you picked (or eclipse picked for you... it tends to do that sometimes) a "WriteRequest" from some other package. The one you want is "com.inductiveautomation.ignition.gateway.sqltags.model.WriteRequest"

Just delete the import from the top of the file that references NIO... and then ctrl-space on the WriteRequest in your code and pick the right one.

---

<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:** [September 27, 2011, 7:24pm UTC](https://forum.inductiveautomation.com/t/synthax-to-write-an-internal-db-tag/3331/5 "2011-09-27T19:24:29Z")

</div>

It’s OK, thanks a lot for your help.  
I’ll check java interface uses…
