Different query result with different OE client version

Posted by Admin on 18-Jan-2010 03:46

Good morning,

Server : always 10.1C04 Win32

Query :

  for each _field where _field-name = "MyField" and (_field._file-recid = 5000 or _field._file-recid = 6000):

    disp _field._file-recid.

  end.

When running this code with a 10.1C04 Win32 client (client/server connection), I'm getting one result (5000 for example).

However if I run the same code using a 10.1A02 Win32 client (also client/server connection to the same database), I don't get any result. If I remove "or _field._file-recid = 6000", I'm getting the correct result.

Does anybody know why I'm getting different results ?

Gilles QUERRET

All Replies

Posted by rbf on 18-Jan-2010 04:11

Because recids change when you dump, reload or whenever PSC feels like it.

NEVER USE STORED RECID FIELDS!!!

-peter

Posted by Admin on 18-Jan-2010 04:16

Recid used in this procedure are just examples. They're not stored in the DB ; the real procedure reads the _File table to be able to find a set of fields in a set of specific tables.

Posted by Admin on 18-Jan-2010 04:31

I'd rather create a dynamic buffer for the tables in question and

query it's field's properties.

I know it!s not an answer to your question, but a workaround.

Posted by Admin on 18-Jan-2010 04:48

The following code works (MyField is found in Table1) :

define buffer b1 for _file.

define buffer b2 for _file.

find b1 where b1._file-name = "Table1".

find b2 where b2._file-name = "Table2".

for each _field where _field-name = "MyField" and (_file-recid = recid(b1) or _file-recid = recid(b2)):

disp _file-recid.

end.

However if I replace recid(b1) with the value (5000 for example), I don't get any result with a 10.1A client...

Posted by Admin on 18-Jan-2010 04:58

Strange... Storing the RECID in integer variables seems to work.

define buffer b1 for _file.

define buffer b2 for _file.

find b1 where b1._file-name = "Table1".

find b2 where b2._file-name = "Table2".

define variable recid1 as integer no-undo.

define variable recid2 as integer no-undo.

assign recid1 = recid(b1) recid2 = recid(b2).

for each _field where _field-name = "MyField" and (_file-recid = recid1 or _file-recid = recid2):

disp _file-recid.

end.

At least, I know how to solve the problem.

This thread is closed