# Foundset is returned  null

**URL:** <https://forum.servoy.com/t/foundset-is-returned-null/16208>\
**Category:** Classic Servoy\
**Created:** [July 16, 2012, 8:08pm UTC](https://forum.servoy.com/t/foundset-is-returned-null/16208 "2012-07-16T20:08:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hardina09](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hardina09](https://forum.servoy.com/u/hardina09)\
**Post date:** [July 16, 2012, 8:08pm UTC](https://forum.servoy.com/t/foundset-is-returned-null/16208/1 "2012-07-16T20:08:56Z")

</div>

I am having form based on a tableA ,to view data. Based on value selected on form, look up for some information. If information is available then data are stored data in another table tableB. To add record in another table I created below Code which throws error message

/\*\*@type{JSFoundset db:/Servernm/tableB}\*/  
FS=databaseManager.getFoundSet(‘Servernm’,‘tableB’) // FS is returned as null  
FS.newRecord(false) //TypeError: Cannot find function newRecord  
``

`
While debugging code FS is returned as null. Any suggestion.`

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [July 16, 2012, 8:22pm UTC](https://forum.servoy.com/t/foundset-is-returned-null/16208/2 "2012-07-16T20:22:24Z")

</div>

Code looks fine to me, but you should declare the FS variable in the 2nd line (var FS = databaseManager…) otherwise putting the JSDoc in your code makes no sense.  
Are you sure the databasename and tablename are correct?

What Servoy version are we talking here anyway? (maybe a nice thing to add in your signature by default ![:)]( "Smile") )

---

<div class="post-metadata">

**Author:** ![hardina09](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hardina09](https://forum.servoy.com/u/hardina09)\
**Post date:** [July 16, 2012, 8:42pm UTC](https://forum.servoy.com/t/foundset-is-returned-null/16208/3 "2012-07-16T20:42:37Z")

</div>

Thanks Marc.  
You are correct.It worked when I added var FS below JSDoc.

I would also like to know regarding foundset. When we load SQL in Foundset and display in form. By defualt it selects 1st record when I say, foundset.getSelectedIndex() by default returns me 1st record in foundset. How Can I check whether no record is selected in form.
