|
| [WD20] HModify a Query result |
| Iniciado por guest, 26,jul. 2016 08:56 - 8 respuestas |
| |
| | | |
|
| |
| Publicado el 26,julio 2016 - 08:56 |
Hi,
I have the following constellation:
I have a query result which is then modified with "hmodify". After that I run a query from this (modified) query. The results doesn´t include the changes which I made with hmodify.
Example:
Hexecutequery(MyQuery1)
for all myquery1 myquery1.myfield=today() hmodify(myquery1) end
Hexecutequery(MyQuery2_from_MyQuery1)
Any hints ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 10:01 |
Hi Michael,
It might depend on the complexity of your queries; i.e. if you have linked files for instance.
Not tried it, but I found this in the Help: http://doc.windev.com/en-US/…
I'd be interested to know your findings because in my code I currently use HReadSeek... functions to re-read records I've retrieved via queries before I HModify them. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 10:12 |
Hi Michael, Assuming that the query comes from a database file, say myfile1, then you will have to use the following:
HexecuteQuery(MyQuery1, hModifyFile)
now you can use hmodify etc on MyQuery1 and it will affect your "base" file in the query. This would be myfiles1.
When you rerun the query you will see the changes. It is NOT always possible to MODIFY using the query - example queries with groups.
hModifyFile is ONLY needed for HFSQL files ...
Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 10:18 |
Hi Steven, Darren,
I don´t want to modify the original dababase files.
I use Hmodify(myquery) to do something that I could not do in a query.
The Problem is shown below: The Filetoarray1 contains the modified values, the Filetoarray2 not ... I believe that the execution of the 2nd Query reverses all changes made with Hmodify.
Hexecutequery(MyQuery1)
for all myquery1 myquery1.myfield=today() hmodify(myquery1) end
Filetoarray(myarray1,myquery1)
Hexecutequery(MyQuery2_from_MyQuery1)
Filetoarray(myarray2,myquery2) |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 10:52 |
Hi Michael, now I see what you are trying to do. The second query is based on the first query ...
Do you have a table or something that is linked to the first query? Maybe this thing (table, etc) RERUNs/REFRESHES your first query?
If you don't find a solution, a workaround would be to use a temporary HF file for the first file
Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 11:33 |
| No, its a stored procedure .... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 13:14 |
Hi Michael,
You are not showing us your code, so it' hard to be sure, but one possible culprit is hreadfirst.
You are saying "...The results doesn´t include the changes which I made with hmodify."
-IF- you are reading your query for whatever reason with hreadfirst and hreadfirst does not contain the option to prevent the RELOADING of the query, you may be executing your original query again at some point, AFTER the hmodifys
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,julio 2016 - 14:05 |
Hi Fabrice,
A query from a query should not execute the based query again ... or ?
If yes this could be the reason .... ok, I try to find a workaround. |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 3 mensajes |
|
| Publicado el 22,agosto 2018 - 09:30 |
Hi, Michael I have the same problem trying to use a modified query in a second query. Have you find a solution? Best regards |
| |
| |
| | | |
|
| | | | |
| | |
|