Page 1 of 1

field can not be found in virtualtable

Posted: Tue 27 Jan 2015 13:17
by jkuiper_nelis
I have a ODBC connection which has fields build as tablename>.<fieldname>.
Assign the query is not a problem, but the property indexfields doesn't know whet to do.
Project *.exe raised exception class Exception with message 'Field DEBOPENPST.CDDEBITEUR not found'.
If I remove the DEBOPENPST, CDDEBITEUR can not be found.

This is my query (with adoconnection and ODBC)

Code: Select all

SELECT DEBOPENPST.BOEKJAAR, DEBOPENPST.CDDEBITEUR, 
             DEBOPENPST.FACTNUMMER, DEBOPENPST.FACTSALDO, 
             DEBOPENPST.FACTSALDOVAL, DEBOPENPST.OPENSTAAND, 
             DEBOPENPST.CDDAGBOEK, DEBOPENPST.PERIODE, 
             DEBOPENPST.FACTDATUM, DEBOPENPST.VERVALDATUM1, 
             DEBOPENPST.VERVALDATUM2, DEBOPENPST.CDVALUTA, 
             DEBOPENPST.CDBETCOND, DEBOPENPST.CDBTW, 
             DEBOPENPST.CDAANMANEN, DEBOPENPST.AANGEMAAND, 
             DEBOPENPST.FACTBEDRAG, DEBOPENPST.FACTBEDRAGVAL, 
             DEBOPENPST.REFERENTIE, DEBOPENPST.KVC, 
             DEBOPENPST.BETKENMERK, DEBOPENPST.CDVERT, 
             DEBOPENPST.TRANSACTIE
FROM SYSADM.DEBOPENPST DEBOPENPST 
WHERE DEBOPENPST.BOEKJAAR = :boekjaar
ORDER BY DEBOPENPST.CDDEBITEUR, DEBOPENPST.FACTNUMMER
This is the code I use

Code: Select all

  QDebopenpst.active := true;
  CDSDebopenpst.assign(QDebopenpst);
  QDebopenpst.active := false;
  CDSDebopenpst.IndexFieldNames := 'DEBOPENPST.CDDEBITEUR';
I'm running MyDAC 8.13.x on Delphi 2009 pro

Re: field can not be found in virtualtable

Posted: Wed 28 Jan 2015 06:52
by ViktorV
To fix the problem, set the TVirtualTable.IndexFieldNames property to a column name without specifying the table name. For example: CDSDebopenpst.IndexFieldNames := 'CDDEBITEUR';