<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>30 Dec 2017 10:18:00 Z</lastBuildDate><pubDate>27 Dec 2017 17:48:00 Z</pubDate><description>Greetings,&#13;
&#13;
I created a report that displays Items that were not sold during the selected period.&#13;
&#13;
&#13;
This is my current code:&#13;
&#13;
HFilter(STOCK,Store_Number,COMBO_STORE.COL_Store_Number,COMBO_STORE.COL_Store_Number)&#13;
HReadFirst(STOCK)&#13;
&#13;
&#13;
nRecRead is int&#13;
nTotal is int = HNbRec(STOCK)&#13;
&#13;
WIN_WAIT.PROGBAR_WAIT_WINDOW = 0&#13;
WIN_WAIT.PROGBAR_WAIT_WINDOW..MaxValue = nTotal&#13;
&#13;
&#13;
HReadSeekFirst(ITEM,Item_Number,STOCK.Item_Number)&#13;
&#13;
WHILE HOut(STOCK) = False&#13;
&#13;
nRecRead += 1&#13;
WIN_WAIT.PROGBAR_WAIT_WINDOW = nRecRead&#13;
&#13;
IF STOCK.Quantity &lt;= 0 THEN&#13;
HReadNext(STOCK)&#13;
CONTINUE&#13;
END&#13;
&#13;
IF COMBO_GROUP..DisplayedValue &lt;&gt; "" AND ITEM.Group_Number&lt;&gt; COMBO_GROUP.COL_Group_Number THEN&#13;
HReadNext(STOCK)&#13;
CONTINUE&#13;
END&#13;
&#13;
HReadSeekFirst(QRY_Items_Sold,"Item_Number",STOCK.Item_Number)&#13;
IF HFound(QRY_Items_Sold) = False THEN&#13;
HReadSeekFirst(QRY_Items_Procured,"Item_Number"",STOCK.Item_Number)&#13;
IF HFound(QRY_Items_Procured) = False THEN&#13;
HReset(TEMP_SS)&#13;
TEMP_SS.Item_Number = STOCK.Item_Number&#13;
TEMP_SS.Item_Barcode = STOCK.Item_Barcode&#13;
TEMP_SS.Item_Name = STOCK.Item_Name&#13;
TEMP_SS.Item_Type = STOCK.Item_Type&#13;
TEMP_SS.Quantity = STOCK.Item_Quantity&#13;
TEMP_SS.Purchase_Price = STOCK.Item_Purchase_Price&#13;
HAdd(TEMP_SS)&#13;
END&#13;
END&#13;
&#13;
HReadNext(STOCK)&#13;
END&#13;
HDeactivateFilter(STOCK)&#13;
HClose(TEMP_SS)&#13;
&#13;
What the code does is that it takes the Item in the STOCK and checks if there were new procurements or sales for that Item in given time period.&#13;
If the Item was not found in the queries, it is written in temporary file that the report will read data from.&#13;
&#13;
This code works, but the problem here is that it takes a lot of time to finish searching for all records that match the criteria.&#13;
These two HReadSeekFirst functions inside While HOut rerun on each record of STOCK and that slows down the performance.&#13;
&#13;
How can I optimize this? Is there any other better way to do it?&#13;
I hope that my explanation was clear and understandable.&#13;
&#13;
Kind Regards,&#13;
Rasta</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed/read.awp</link><title>[WD22] Optimizing data search speed</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63815/read.awp</comments><pubDate>30 Dec 2017 10:18:00 Z</pubDate><description>Rasta,&#13;
&#13;
create a query on the STOCK file including an LEFT OUTER JOIN to the ITEMS_SOLD file and a LEFT OUTER JOIN to the ITEM…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63815/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63815/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed/read.awp">[WD22] Optimizing data search speed</source><title>Re: [WD22] Optimizing data search speed</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63810/read.awp</comments><pubDate>29 Dec 2017 12:27:00 Z</pubDate><description>Hi.&#13;
&#13;
You are scrolling through the complete file so that HFilter checks whether or not a record meets the query conditions.&#13;
&#13;…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63810/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63810/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed/read.awp">[WD22] Optimizing data search speed</source><title>Re: [WD22] Optimizing data search speed</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63802/read.awp</comments><pubDate>27 Dec 2017 18:27:00 Z</pubDate><description>SQL Queries. They will almost always be faster than a bunch of hFunctions.</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63802/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed-63802/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/63798-wd22-optimizing-data-search-speed/read.awp">[WD22] Optimizing data search speed</source><title>Re: [WD22] Optimizing data search speed</title></item></channel></rss>
