# another load records by query problem

**URL:** https://forum.servoy.com/t/another-load-records-by-query-problem/3057
**Category:** Classic Servoy
**Created:** [November 14, 2004, 2:42pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057 "2004-11-14T14:42:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gstein](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gstein](https://forum.servoy.com/u/gstein)
#### Post date: [November 14, 2004, 2:42pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/1 "2004-11-14T14:42:47Z")

</div>

I have a form, client\_employees, which I want to display in a popup form and limit it with only the client\_employees of the current selected client on the client form.

In code I create the query and then use loadrecords to open the form with just the records I want showing.

The problem is when the form opens the right number of records have been selected, but both fields are blank and when I try to click into either field I get a “No record. Create one first.” message.

I have examined the SQL that the query is using and it is getting the right values.

Here is a copy of the code:

```auto
var myClient = forms.clients.id_clients
var query = 'SELECT client_employees.id_people, client_employees.id_t_client_employees FROM client_employees WHERE client_employees.id_client = ' + myClient + ' order by client_employees.id_people, client_employees.id_t_client_employees';
application.output(query)
forms.client_employees.controller.loadRecords(query)
application.showFormInDialog(forms.client_employees,-1,-1,-1,-1, " Employees of " + globals.GetValueListValue("Clients", myClient))

```

What am I doing wrong???

---

<div class="post-metadata">

### Author: ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)
#### Post date: [November 15, 2004, 11:57am UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/2 "2004-11-15T11:57:37Z")

</div>

> gstein:  
> …The problem is when the form opens the right number of records have been selected…

Some questions:

1. how could you see the right number of records?
2. is the form you want to show in record view? (does it show records in listview)
3. is there an error in .log.txt?

---

<div class="post-metadata">

### Author: ![gstein](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gstein](https://forum.servoy.com/u/gstein)
#### Post date: [November 15, 2004, 12:44pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/3 "2004-11-15T12:44:50Z")

</div>

\<1) how could you see the right number of records? \>

I can see I have the right number of records from the query because I can do: application.output(query) and check the query in Interactive Sql. Plus, when the form opens, I do see the right number of records on the form, but the values are empty and I can’t edit it.

\<2) is the form you want to show in record view? (does it show records in listview) \>

The form is in listview. If I open it without using loadRecords it works fine.

\<3) is there an error in .log.txt?\>

No

---

<div class="post-metadata">

### Author: ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)
#### Post date: [November 16, 2004, 1:59pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/4 "2004-11-16T13:59:30Z")

</div>

2 more questions,

1. the columns you select are both pks?
2. are you running Servoy 2.1.1?

---

<div class="post-metadata">

### Author: ![gstein](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gstein](https://forum.servoy.com/u/gstein)
#### Post date: [November 16, 2004, 3:23pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/5 "2004-11-16T15:23:38Z")

</div>

\<the columns you select are both pks? \>

No. id\_people is part of the pk but id\_t\_client\_employees isn’t, but I need to select them both becuase I need them both on the form.

\<are you running Servoy 2.1.1?\>

Yes.

---

<div class="post-metadata">

### Author: ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)
#### Post date: [November 18, 2004, 3:53pm UTC](https://forum.servoy.com/t/another-load-records-by-query-problem/3057/6 "2004-11-18T15:53:16Z")

</div>

> gstein:  
> \<the columns you select are both pks? \>  
> No. id\_people is part of the pk but id\_t\_client\_employees isn’t, but I need to select them both becuase I need them both on the form.

ah, thats the problem… the docs/sample clearly states do “only” select the pk…! after that a Servoy form will just work as use without a query (i.e. all the fields will be accesseble)
