# Pass parameter to tag.writeAsync

**URL:** <https://forum.inductiveautomation.com/t/pass-parameter-to-tag-writeasync/43485>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 16, 2021, 9:12pm UTC](https://forum.inductiveautomation.com/t/pass-parameter-to-tag-writeasync/43485 "2021-02-16T21:12:07Z")\
**Posts on this page:** 1\
**Showing post:** 13

<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:** [February 17, 2021, 4:04pm UTC](https://forum.inductiveautomation.com/t/pass-parameter-to-tag-writeasync/43485/13 "2021-02-17T16:04:49Z")

</div>

Sorry, I was pulled into a meeting as I was typing this, but if it helps, I do have a function to generate question marks for prep inserts.

```python
def prepInsertQmarks(numOfGroups, groupSize):
	''' 
	    Generate a string of grouped question marks for prepUpdate inserts
	    example: Generate three groups of four question marks:
	    prepInsertQmarks(3, 4) returns (?,?,?,?),(?,?,?,?),(?,?,?,?)
	'''
	group = '(' + ','.join(['?'] * groupSize) + ')'
	return ','.join([group] * numOfGroups)
	

query = """
INSERT INTO [dbo].[DATA_RAW]
	([EQUIP_NUM]
	,[TIMESTAMP]
	,[PART_NUMBER]
	,[JOB_NUMBER]
	,[SAMPLE_NUMBER]
	,[SAMPLE_MEASUREMENT])
VALUES %s""" % prepInsertQmarks(4,6)
		
print query

```

Output:

```nohighlight
INSERT INTO [dbo].[DATA_RAW]
	([EQUIP_NUM]
	,[TIMESTAMP]
	,[PART_NUMBER]
	,[JOB_NUMBER]
	,[SAMPLE_NUMBER]
	,[SAMPLE_MEASUREMENT])
VALUES (?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/pass-parameter-to-tag-writeasync/43485)._
