query receive value from another query

Asked

Viewed 520 times

0

There is a way for a Tibquery to receive the other Tibquery. For example:

Query1.Close;
Query1.Open;
Query2 := Query1;
if Query2Valor1.... // segue a lógica
  • Confirming What You Want: A query receives data from the other query? Or Tfields? SQL?

  • A query receiving data from another Query.

  • @Tiagocasanova normally one component receives EVERYTHING from the other if it is the same class. That is, your example should already work!

  • Query2valor1 does not work for example it does not bring any value.

  • @Júniormoreira I understand that the code exemplified by Tiago only makes Query2 point in memory to Query1, but Query2 does not receive data from Query1. With this technology (IB) reality is what I answered below...

  • is what @Andrey said, he can still take the values through the method FieldByName() since the TFields is not copied (as already mentioned Query2 only references to Query1, it is not a copy)... the method Assign() if implemented makes the copy, ie creates a new reference... but if the class TIBQuery to implement

Show 1 more comment

1 answer

1

With the IB I believe it is not possible.
Already with the Firedac is possible through the TFDDataSetReference, on which you can pass the property data of a dataset to another as follows:
FDQuery2.Data := FDQuery1.Data;

But back to your reality, it would be possible to still pass the content of Tibquery for a Clientdataset by means of Datasetprovider.
I do not know if it is acceptable for your need, but I use quite this above mentioned feature.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.