PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 23 → WINDEV needs to wait for table to be filled
WINDEV needs to wait for table to be filled
Débuté par PADSOFT, 07 aoû. 2018 09:36 - 2 réponses
Membre enregistré
4 messages
Posté le 07 août 2018 - 09:36
I am using a memory table linked to a Query.
The result of this query can be 600.000 records. Inside a "For all" loop I am filtering on this table. The filtering item (sWaarde) is found in query QRY_Cadency_files. The result of the filtering must be exported into an Excel file.
It seems that the table is not yet finalized when the export is started. Resulting in unreadable XLSX or XML files.
Is there a way to have the program only export when the loading of the table is finished?
For now I have put a multitask, but this is not helping. Small files are exported correctly.

This is the code:

HExecuteQuery(QRY_Cadency_files)
FOR ALL QRY_Cadency_files ON Cadency
sWaarde=QRY_Cadency_files.Cadency
openfile=folder+"\"+maand+"_"+Process_cntry+"_"+companie+"_"+sWaarde+".xlsx"
TableEnableFilter(Table_Ageing.COL_Cadency,filterEqual,sWaarde)
IF TableCount(Table_Ageing)<>0 THEN
IF TableCount(Table_Ageing)> 80000 THEN
Multitask(1000)
TableToExcel(Table_Ageing,Openfile,taColumnsTitles)
Multitask(1000)
ELSE
TableToExcel(Table_Ageing,Openfile,taColumnsTitles)
Multitask(100)
END
END
PROGBAR_export++
END


I am using WINDEV 22
Message modifié, 07 août 2018 - 09:43
Posté le 07 août 2018 - 14:20
Hi,

You could load the table by code instead of linking it to the query, or
you could export to xls directly from the query without using a table.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


On 8/7/2018 1:36 AM, PADSOFT wrote:
I am using a memory table linked to a Query.
The result of this query can be 600.000 records.  Inside a "For all"
loop I am filtering on this table.  The filtering item (sWaarde) is
found in query QRY_Cadency_files.  The result of the filtering must be
exported into an Excel file.
It seems that the table is not yet finalized when the export is
started.  Resulting in unreadable XLSX or XML files.
Is there a way to have the program only export when the loading of the
table is finished?
For now I have put a multitask, but this is not helping.  Small files
are exported correctly.

This is the code:

HExecuteQuery(QRY_Cadency_files)
FOR ALL QRY_Cadency_files  ON Cadency
    sWaarde=QRY_Cadency_files.Cadency
    openfile=folder+"\"+maand+"_"+Process_cntry+"_"+companie+"_"+sWaarde+".xlsx"
    TableEnableFilter(Table_Ageing.COL_Cadency,filterEqual,sWaarde)
    IF TableCount(Table_Ageing)<>0 THEN
         IF TableCount(Table_Ageing)> 80000 THEN
              Multitask(1000)
            TableToExcel(Table_Ageing,Openfile,taColumnsTitles)
            Multitask(1000)
        ELSE
            TableToExcel(Table_Ageing,Openfile,taColumnsTitles)
            Multitask(100)
         END
    END
    PROGBAR_export++
END


I am using WINDEV 22
Membre enregistré
4 messages
Posté le 07 août 2018 - 16:29
Thanks Fabrice, I will try to create the Excel file directly from the query after filtering with a parameter.

Kind regards, Peter

--
Peter Adema
WINDEV programmer since 2012