how to use addQuery using a variable for 2nd parameter.

jmcagod
Kilo Guru

I have the following tables: Project and Equipment Table.

I have a field in Equipment table called 'project' that is referenced from 'number' field in Project table (which is my primary key and is auto incremented every time new project record is added).

I'm trying to retrieve all equipment records that is tied to a project record.

1Capture.PNG

The value it returns is 0. I tried to execute the query without   the addquery ( I got a value which is correct).

This leads me to suspect that there is something wrong with how I use AddQuery.

1 ACCEPTED SOLUTION

Anthony_vickery
Tera Expert

The syntax looks good, but I suspect that maybe your 'project' field is called u_project or perhaps even a reference field, which would store the project's sys_id value, rather than the number. Have a look in the dictionary for the project field to check its name and type.


View solution in original post

2 REPLIES 2

Anthony_vickery
Tera Expert

The syntax looks good, but I suspect that maybe your 'project' field is called u_project or perhaps even a reference field, which would store the project's sys_id value, rather than the number. Have a look in the dictionary for the project field to check its name and type.


Thank you! With further observation, I figured that it was the reference field which stores the sys_id.