# Creating form from a Dataset

**URL:** <https://forum.servoy.com/t/creating-form-from-a-dataset/10362>\
**Category:** Classic Servoy\
**Created:** [March 5, 2009, 2:03pm UTC](https://forum.servoy.com/t/creating-form-from-a-dataset/10362 "2009-03-05T14:03:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andres\_achiary](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@andres\_achiary](https://forum.servoy.com/u/andres_achiary)\
**Post date:** [March 5, 2009, 2:03pm UTC](https://forum.servoy.com/t/creating-form-from-a-dataset/10362/1 "2009-03-05T14:03:16Z")

</div>

Hi all… i was trying to create a form from a dataset created by an array. My method code is

```auto
                history.removeForm('p')
	solutionModel.removeForm('p')
	
	var a = new Array()
	a = databaseManager.getTableNames(forms.clientes.controller.getServerName())
	var ds = databaseManager.convertToDataSet(a)
	var uri = ds.createDataSource('test', [DM_COLUMNTYPE.TEXT])
	
	var jsform = solutionModel.newForm('p', uri, null, true, 300, 300);
	var f = jsform.newField('ds',SM_DISPLAYTYPE.TEXT_FIELD,100,100,100,20)
	var datapr = f.dataProviderID
	application.output(datapr)
    	

	forms.p.controller.show()

```

In the field i put in the form, the data is not shown and i know there are records (the navigator shows there are records). Also i tried putting ‘test’ and ‘a’ to the dataprovider in the field but i have the same problem. How can i associate the field with the dataset i want to show???

Thank you

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [March 5, 2009, 2:26pm UTC](https://forum.servoy.com/t/creating-form-from-a-dataset/10362/2 "2009-03-05T14:26:14Z")

</div>

With convertToDataSet you can provide an array of names that will be used as the dataprovider names.

For example in your case:

```auto
var ds = databaseManager.convertToDataSet(a, ["tablename"]);

```

---

<div class="post-metadata">

**Author:** ![andres\_achiary](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@andres\_achiary](https://forum.servoy.com/u/andres_achiary)\
**Post date:** [March 5, 2009, 3:12pm UTC](https://forum.servoy.com/t/creating-form-from-a-dataset/10362/3 "2009-03-05T15:12:50Z")

</div>

thank you, Joas, that did it… it was so easy jej…

Andres
