# Selecting stored calc in .getDatasetByQuery

**URL:** <https://forum.servoy.com/t/selecting-stored-calc-in-getdatasetbyquery/7836>\
**Category:** Classic Servoy\
**Created:** [July 17, 2007, 8:26pm UTC](https://forum.servoy.com/t/selecting-stored-calc-in-getdatasetbyquery/7836 "2007-07-17T20:26:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSharp](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JSharp](https://forum.servoy.com/u/JSharp)\
**Post date:** [July 17, 2007, 8:26pm UTC](https://forum.servoy.com/t/selecting-stored-calc-in-getdatasetbyquery/7836/1 "2007-07-17T20:26:16Z")

</div>

Hi all,

I am trying to extract a set of fullname calculations to use as display values in a valuelist. I have the problem that I can not seem to grab the calculated values with my sql query but can select other dataproviders.

```auto
SELECT DISTINCT n.fullnameb, c.contact_id FROM contact c INNER JOIN names n ON c.name_id = n.name_id WHERE c.caregiver_id='" + globals.gContactID + "'";

```

“fullnameb” is also a calculation on the names table.

```auto
var fullname = "";
if(title != null) {
	fullname += names_to_title.title
}
if(fname != null && fname != "") {
	fname + " ";
}
if(mi != null && mi != "") {
	fullname += mi + " ";
}
if(lname != null && lname != "") {
	fullname += lname + " ";
}
if(suffix != null) {
	fullname += names_to_suffices.suffix;
}
return fullname;

```

Prior to calling .getDatasetByQuery() I call:

```auto
databaseManager.recalculate(forms.names.foundset);
databaseManager.refreshRecordFromDatabase(forms.names.foundset, -1);

```

However, I keep getting null values returned in my dataset, while if I select n.fname I get the first names.

Am I missing something?

Jon

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [July 19, 2007, 3:51pm UTC](https://forum.servoy.com/t/selecting-stored-calc-in-getdatasetbyquery/7836/2 "2007-07-19T15:51:38Z")

</div>

Hi Jon,

you need to make the ‘fullnameb’ stored in Servoy.  
Then you may need to refresh the calculations on the existing records to populate the field with the latest values.

Look at

recalculate()

in the database manager node.

Hope this helps,
