0

I have a TUniQuery in Delphi, using the DevArt component.

This works fine, and I can assign values using syntax like qry1.Fields[1].AsString.

But to avoid absolute indexing of database fields I would like to work with field names instead. After doing some research on forums, I found that the following works as well: qry.fieldbyname('fieldname').AsString.

Unfortunately, as DevArt documentation states : "It publishes most of its inherited properties" (my enhancement). FieldByName is one of the unpublished properties.

In the code I can write qry.parent.fieldbyname('fieldname').AsString which works, but I would like to avoid what I see as a "hack".

So, as TCustomUniDataSet is the parent of TUniQuery, how do I get to work with it, and the recordset of TQuery ? Devart does recommend working with TUniquery, but what is then my way forward for non-published properties ?

Applications should never use TCustomUniDataSet objects directly. Instead of TCustomUniDataSet, they should use TCustomUniDataSet descendants, such as TUniQuery and TUniTable, which inherit its dataset-related properties and methods.

MyICQ
  • 987
  • 1
  • 9
  • 25
  • 1
    Finding it hard to make sense of what you are asking. FieldByname works for TUniQuery (as seen in some of the examples in the getting started: https://www.devart.com/unidac/docs/basics.htm). What doesn't work for you? – Brian Aug 13 '21 at 17:42
  • @Brian it does work, but I do not have autocomplete i the IDE, probably because the property `FieldByName` exists, but is not published. So I have to remember that it's there. As the property IS published in parent, I can use the `parent` reference, but I think there should be a better way ? – MyICQ Aug 16 '21 at 07:47

0 Answers0