PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Exporting Query to EXCEL (WD7.5) ... again
Exporting Query to EXCEL (WD7.5) ... again
Débuté par Swissstephan, 09 jan. 2004 18:06 - 1 réponse
Posté le 09 janvier 2004 - 18:06
Hello
I guess this topic can bore you but I think a read every possible line in the manual, helptext and ofcourse in this forum but I can't find an answer.
I simply (probabely not) want to export a query result to an excel file without showing anything in a window.
what do i do wrong.
This is my best guess
Line 1,3,4 run fine it's the second one ...
1.IF HExecuteQuery(lcQueryName, hQueryDefault, ldStartDateTime, ldEndDateTime) THEN
//info(hnbrec(lcQueryName))
2.TableToExcel(lcQueryName, lcOutputFile)
3.HCancelDeclaration(lcQueryName)
4.END
If someone has an idea, please :-)
Thanks in advance
Stephan
Posté le 12 janvier 2004 - 17:17
All you need is a memory table to hold each row of lcQueryName and loop thru'
until
the last record reached.

You may add the code after line 1 shown as below:

HreadFirst(lcQueryName)
While not h.out
TableAdd(myMemoryTable, lcQueryName.column1+tab+lcQueryName.column2+tab+...)
HReadNext(lcQueryName)
End

//carry on yr line 2 as below
2.TableToExcel(myMemoryTable, lcOutputFile)

But it's a good idea to have a proposed function like line 2 of named

HQueryResultToExcel(lcQueryName) //Direct them all, why not

Technical speaking, HReadFirst(lcQueryName) works like a cursor
(pointer to the first record) and
TableAdd() works like fetching the contents into a memory table (buffer).
When the end of record reached and fetched, you should get what you want.

Happy again!

Regs

King


Swissstephan <iswiestner@bluewin.ch> wrote:

Hello
I guess this topic can bore you but I think a read every possible line in

the manual,
helptext and ofcourse in this forum but I can't find an answer.
I simply (probabely not) want to export a query result to an excel file

without showing
anything in a window.
what do i do wrong.
This is my best guess
Line 1,3,4 run fine it's the second one ...
1.IF HExecuteQuery(lcQueryName, hQueryDefault, ldStartDateTime, ldEndDateTime)

THEN
//info(hnbrec(lcQueryName))
2.TableToExcel(lcQueryName, lcOutputFile)
3.HCancelDeclaration(lcQueryName)
4.END
If someone has an idea, please :-)
Thanks in advance
Stephan