# How to create Table from Array Data ?

**URL:** <https://forum.servoy.com/t/how-to-create-table-from-array-data/10442>\
**Category:** Classic Servoy\
**Created:** [March 18, 2009, 1:09pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442 "2009-03-18T13:09:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 18, 2009, 1:09pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/1 "2009-03-18T13:09:22Z")

</div>

Hi I’m new to Servoy  
I want to create a form with a Table (Grid) where column data are stored in separate arrays. Not taking directly from the DB columns. Also I want to do the common table manipulations such as add row, remove row, select, sort by column etc.

Can I achieve this with Servoy ?

Please tell me a method or an example .

Thank you  
 ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [March 18, 2009, 2:46pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/2 "2009-03-18T14:46:57Z")

</div>

Have a look at this thread: [http://forum.servoy.com/viewtopic.php?f=1&t=11505&st=0&sk=t&sd=a](http://forum.servoy.com/viewtopic.php?f=1&t=11505&st=0&sk=t&sd=a)

---

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 18, 2009, 5:16pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/3 "2009-03-18T17:16:28Z")

</div>

hi

Thanks for your reply.

I tried according to that thread. but for the function “ds.createDataSource()” it gave an error saying “Cannot find function createDataSource.”

Please help me on this.

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [March 18, 2009, 6:17pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/4 "2009-03-18T18:17:23Z")

</div>

Paste the code you are using and I will have a look at it.

---

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 19, 2009, 5:37am UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/5 "2009-03-19T05:37:36Z")

</div>

Hi

my above problum was manged to slove.

But I couldnt get the “Table View Locked” view , It comes only the record view

my code as follows

{  
var ds = databaseManager.createEmptyDataSet()  
ds.addColumn(“price”)  
ds.addColumn(“model”)  
ds.addRow([1000, ‘BMW’])  
ds.addRow([2000, ‘Audi’])  
ds.addRow([3000, ‘Peugeot’])

var uri = ds.createDataSource(‘mydata’, [DM\_COLUMNTYPE.INTEGER, DM\_COLUMNTYPE.TEXT]);

// display\_form is a blank form with no table  
var myform = solutionModel.getForm(‘display\_form’)

myform.dataSource = uri

myform.newField(“price”,SM\_DISPLAYTYPE.TEXT\_FIELD,100,100,100,20);  
myform.newField(“model”,SM\_DISPLAYTYPE.TEXT\_FIELD,210,100,100,20);

myform.view = SM\_VIEW.LOCKED\_TABLE\_VIEW;

application.showFormInDialog(forms.display\_form , 210, 220, 525, 440, “My Form”, false, false, “My Form”, true);

}

Please tell me what should i do to get the Table view.

Thank You

---

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 19, 2009, 12:24pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/6 "2009-03-19T12:24:43Z")

</div>

Hi  
also I want to assign a value list (combo box) to one of the field. please show me a code sample for achieving  
this.  
Thanks

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [March 19, 2009, 12:41pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/7 "2009-03-19T12:41:18Z")

</div>

Hi,

You say you aren’t getting a tableview. What are you getting instead?

---

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 19, 2009, 1:38pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/8 "2009-03-19T13:38:11Z")

</div>

A Record View

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [March 19, 2009, 1:40pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/9 "2009-03-19T13:40:16Z")

</div>

And you haven’t viewed the display\_form before you altered it’s blueprint using the Solution Model? The new fields you added do show up?

---

<div class="post-metadata">

**Author:** ![Caran09](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@Caran09](https://forum.servoy.com/u/Caran09)\
**Post date:** [March 19, 2009, 1:50pm UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/10 "2009-03-19T13:50:45Z")

</div>

yes,  
the display\_form is a blank form, the new fields I added show as normal Record view. If i set default navigator to display\_form record I can navigate records.

So it is perfectly loks like a form with Record view , but not a Table view as I expected

---

<div class="post-metadata">

**Author:** ![lvostinar](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lvostinar/32/5248_2.png) [@lvostinar](https://forum.servoy.com/u/lvostinar)\
**Post date:** [March 30, 2009, 7:18am UTC](https://forum.servoy.com/t/how-to-create-table-from-array-data/10442/11 "2009-03-30T07:18:06Z")

</div>

> Caran09:  
> yes,  
> the display\_form is a blank form, the new fields I added show as normal Record view. If i set default navigator to display\_form record I can navigate records.
> 
> So it is perfectly loks like a form with Record view , but not a Table view as I expected

This is related to a bug which is now fixed (starting with next release).
