PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → Exporting Query to EXCEL (WD7.5) ... again
Exporting Query to EXCEL (WD7.5) ... again
Iniciado por Swissstephan, jan., 09 2004 6:06 PM - 1 resposta
Publicado em janeiro, 09 2004 - 6:06 PM
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
Publicado em janeiro, 12 2004 - 5:17 PM
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