Great!
I think the program is very fast. Reading the article register takes now about 563-1000 ms., 176,7MB
I made an another test file like this .:
Code: Select all
; Products.csv
ArtNo;Counts
"00013-17";35
"00013-17";5
"7392248100257";14
"BG29647";6
"00013-17";10
00123ABC;35
"0105413";5
"NOT_VALID";10
the result (4 of 8 records found by ID) .:
ID: 00013-17 - Count: 50 - RecIndex: 3
ID: 0105413 - Count: 5 - RecIndex: 473
ID: BG29647 - Count: 6 - RecIndex: 24281
ID: GT10025 - Count: 14 - RecIndex: 24493
Correct!
(1 of 8 records found by Supplier ID) .:
Line: 00123ABC;35 - Records: 19 2326 25797
It's correct!
(1 of 8 records could not be found) .:
"NOT_VALID";10
Does it matter if
SetBatchLines, -1 comes before or after
#NoEnv?
(the function "ErrorExit(Msg)" was missed in the second version...)
The next problem is that the field "art_ean" is field number 17 and "art_ean2" is field number 41 and so on (if I counted right).
(For example 7392248100257 and 00123ABC is not found, but when I redo the file, with the fields in the correct order, the program works.).
I have ordered the export of the CSV file with the fields in my order, I hope that it will be delivered in UTF-8 format, but not yet delivered....
Another problem is that the "Product File" may contain different number of columns.
When the file is generated by the PDA:s, the file has 6 (or 7 fields).
The first two are ArtNo and Count (after these comes the following fields.: PDA name, location, user, date and time)
Then, the input file can be manually added with products with only these two fields (ArtNo and Count)
(If I interpret the script correctly, these manually added lines will disappear - have not been tested)
I like your solution. It is very compact and fast, but not so general.
_____________________________________________________
The fact that the article register is large does not seem to cause problems for AHK (about 31,000 products and about 70 fields).
Of these products is approx. 6-8,000 active today. This register will grow by about 10% per year. One field contains whether the product is active or inactive.
But when the article register is to be read in, for example, PDAs, it's no advantage that the file is large (just taking time). PDA only needs 10 fields and these 6-8000 products.
i.e. Another need is to convert the large registry into a custom smaller registry. (Memor.csv)
or create a result with the fields .: art_id, art_name, prodinfo1, prodinfo2, count, art_purce_price and the sum (count * art_purce_price)
One result is with all products
Another result is only from art_grp_no (product group) 7000-7010
Another result is from each supplier
and so on.
I will try to interpret your program, and if it is possible to do more generally.
for example,
- A function that reads and handle a CSV file "
- A function that searches barcodes and item numbers. (as in your example)
- A function as select desired fields and rows.
- Another function that provides a desired result (in some way)