# QuerySetRow

Adds or updates a row in a query based on the provided row data and position.

## Method Signature

```
QuerySetRow(query=[query], rowNumber=[integer], rowData=[any])
```

### Arguments

| Argument    | Type      | Required | Description                                                                          | Default |
| ----------- | --------- | -------- | ------------------------------------------------------------------------------------ | ------- |
| `query`     | `query`   | `true`   | The query object to which the row should be added or updated.                        |         |
| `rowNumber` | `integer` | `false`  | Optional position of the row to update; if omitted or zero, a new row will be added. | `0`     |
| `rowData`   | `any`     | `true`   | A struct or array containing data for the row.                                       |         |

## Examples

### Builds a simple query using queryNew and querySetRow

Sets third row of query overwriting news entry

[Run Example](https://try.boxlang.io/?code=eJxtkDFvAjEMhefLr3jK1EpZWtqlVZeKFQZAYkAdUjAQNTitkyOgiv9eH3Th2sWyrfc%2BJ4%2BpZrzgqyU5jqnewIaVK6FEsk57LrQhcXsvy60XXS1gmm%2FTNCqzeMKd6%2FqLXkc7pEpHrGhNvmTMpN15tqY5uSvXfc81Ikb18QOJMUrpH8eg5xiHg2onlMOG81%2F5Q08%2B2xJeSWJgzH2MWGs528wbbp%2FN%2BfdTKpOkAbAm4vQglPeLe1Rcj9YlI0wFIeM9iT751JGqhELDdvd54XSrHzO%2FYVg%3D)

```java
news = queryNew( "id,title", "integer,varchar", [ 
	{
		"id" : 1,
		"title" : "Dewey defeats Truman"
	},
	{
		"id" : 2,
		"title" : "Men walk on Moon"
	},
	{
		"id" : 3,
		"title" : "Nixon Resigns"
	},
	{
		"id" : 4,
		"title" : "The Berlin Wall falls"
	}
] );
querySetRow( news, 3, {
	"id" : 5,
	"title" : "The internet is born"
} );
writeDump( news );

```

### Builds a simple query using queryNew and someQuery.setRow member syntax

Sets third row of query overwriting news entry

[Run Example](https://try.boxlang.io/?code=eJxtkMFKQzEQRdcvX3HJqkIQtLpR3Ei37aIUuiguop22wXSik7ymRfrvTtSNTzdhMtxzGC5TzXjAe09ymlEdwYa1K6FEsk5nLrQlcQcvLzsvulrBdB%2Bm6zRmcYcr1%2BbvvH7thCqdsKYN%2BZKxkH7v2Zru7H5R1wNqSozq4ysSY5rSP8R4QMzCUbNzymHL%2BW%2F8ZhBf7AiPJDEwlj5GbPT5wswTLu4NawmXmco8aQFjBzX9iG5VNPC0ToSpIGQ8J9Fjz81RJRSa9Pu3EZqurT4ByRxfJA%3D%3D)

```java
news = queryNew( "id,title", "integer,varchar", [ 
	{
		"id" : 1,
		"title" : "Dewey defeats Truman"
	},
	{
		"id" : 2,
		"title" : "Men walk on Moon"
	},
	{
		"id" : 3,
		"title" : "Nixon Resigns"
	},
	{
		"id" : 4,
		"title" : "The Berlin Wall falls"
	}
] );
news.setRow( 3, {
	"id" : 5,
	"title" : "The internet is born"
} );
writeDump( news );

```

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJxljz0LwjAQhufkVxyZFLL4tShuzoI6ikPQ06S0aU2vliL9716KQmun%2B%2BC5h3sJSzpUGBrYwjPWPdYTUO6mvclQaW494QODfplwtSbw6gxSvKUQTClYw0zHvsN5Ugl6d8egpGj1gJsPOZOYZgwt%2FmS59WNoOYTKzJGNlLzAdCO7GCekY85J6JdPsxrY8VWsWNH7JS2sUbKN53VwhLsqK3rHcf8BgkBNzA%3D%3D)

```java
testQuery = queryNew( "id,name", "integer,varchar", [ 
	{
		"id" : 1,
		"name" : "jenifer"
	},
	{
		"id" : 2,
		"name" : "ajay"
	},
	{
		"id" : 3,
		"name" : "john"
	},
	{
		"id" : 4,
		"name" : "smith"
	}
] );
querySetRow( testQuery, 3, {
	"id" : 5,
	"name" : "alpha"
} );
writeDump( testQuery );

```

## Related

* [QueryAddColumn](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryaddcolumn)
* [QueryAddRow](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryaddrow)
* [QueryAppend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryappend)
* [QueryClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryclear)
* [QueryColumnArray](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycolumnarray)
* [QueryColumnCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycolumncount)
* [QueryColumnData](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycolumndata)
* [QueryColumnExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycolumnexists)
* [QueryColumnList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycolumnlist)
* [QueryCurrentRow](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querycurrentrow)
* [QueryDeleteColumn](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querydeletecolumn)
* [QueryDeleteRow](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querydeleterow)
* [QueryEach](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryeach)
* [QueryEvery](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryevery)
* [QueryFilter](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryfilter)
* [QueryGetCell](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querygetcell)
* [QueryGetResult](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querygetresult)
* [QueryInsertAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryinsertat)
* [QueryKeyExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querykeyexists)
* [QueryMap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querymap)
* [QueryNew](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querynew)
* [QueryNone](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querynone)
* [QueryPrepend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryprepend)
* [QueryRecordCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryrecordcount)
* [QueryRecordCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryrecordcount)
* [QueryReduce](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryreduce)
* [QueryRegisterFunction](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryregisterfunction)
* [QueryReverse](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryreverse)
* [QueryRowData](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryrowdata)
* [QueryRowSwap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryrowswap)
* [QuerySetCell](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querysetcell)
* [QuerySlice](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/queryslice)
* [QuerySome](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querysome)
* [QuerySort](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/query/querysort)
