Jump to content

Arrays?


Recommended Posts

I have a list of maybe 5,000 part numbers, each part number has maybe 1 - 300 different customer part numbers associated with it. What would be the best way to search this data?

I believe an array would be best (I think). I haven't the slightest idea where to start though and need a push.

FYI: The user enters are part number and the customer part number into the program. I want something that will look to see if that part number has been used before; if so it allows the user to continue uninterrupted, if it hasn't been used yet it alerts the user.

Any help is greatly appreciated.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

i tryed making an array with [5000][300] but it took WAY to long:

it came to $av_array[234][21] in 63.771 seconds. (3.4 ghz pc)

IMO i would use a ini/text file.

<{POST_SNAPBACK}>

Our # Customer #

DS1050K 30-2696050

DS1051S AXXPEDS1051S

DS1051S AXXPEDS1051S

DS1051S 30-2696051

DS1051S 30-2696051

DS1051S DS1051S

DS1069K A-DS1069

Above is a small cross section of my data. If the user enters part number DS1051S into the program how will it search? I originally thought to use a INI with the Key field being our part number and the requested data being the number of possibilities but thats where I got stuck.

How would I make it work with INI/TXT files?

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

I would use a separate text file for each DS*****, and then put the sub-part number, that way you can quickly search text files no matter how many main parts you have

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

I would use a separate text file for each DS*****, and then put the sub-part number, that way you can quickly search text files no matter how many main parts you have

<{POST_SNAPBACK}>

I'm not to partial to having over 5,000 (at least) text files.
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

what about DS10****

<{POST_SNAPBACK}>

That was only an example of the data for instance DS1051S has 3 different customer part numbers. While DS1050K has just one. Some of our part numbers have 300ish corresponding customer part numbers.

Edit: I'm sorry I see, your sayin' combine part numbers that way I might have only 2500 txt files. The only problem I see is that It needs to be added to If the user says that this is a new customer part number. How would it know which txt file to write the line into?

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

Sounds like a job for a Visual Basic database, Microsoft Excel, or Access.

<{POST_SNAPBACK}>

autoit can "talk" to excel throught COM (its in the beta).

so i would go for that.

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

That's the only other thing I can think of...What you may want to do is look into a DSN connection, that way you wouldn't have to re-write code for whichever type of database you want to use, whether it be MS Access, Excel, SQL, MySQL, etc...

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

That's the only other thing I can think of...What you may want to do is look into a DSN connection, that way you wouldn't have to re-write code for whichever type of database you want to use, whether it be MS Access, Excel, SQL, MySQL, etc...

<{POST_SNAPBACK}>

Pardon my ignorance. Please define what you meant by "DSN connection".

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

an ADO connection actually...hold on.

Control Panel -> Administrative Tools -> Data Sources (ODBC) -> User DSN -> Add

That will show you all of the default filetypes that ODBC can manage...and it *should* all work with the same command if you set up a connection to it. That way if you wanted to...you could start off in flat text files or Excel, upgrade to Access or SQL if you want...or any other database that has ODBC support

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

I'm not to partial to having over 5,000 (at least) text files.

<{POST_SNAPBACK}>

You could have it all in one TAB delimited file.

DS1050K{tabchar}30-2696050

DS1051S{tabchar}AXXPEDS1051S{tabchar}30-2696051{tabchar}DS1051S

DS1069K{tabchar}A-DS1069

use _FileReadToArray() to put it all in a one dimensional array

When the P/N is entered use _ArrayBinarySearch() to search the array for the P/N in question. When found, use StringSplit to put it in a secondary array for display. It wouldn't matter whether you searched for Your P/N or a Customer P/N. You'd get it fairly quick and you would have a cross-reference function with no additional programing.

Or I misunderstood the problem...

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

I have a list of maybe 5,000 part numbers, each part number has maybe 1 - 300 different customer part numbers associated with it. What would be the best way to search this data? 

Try Hash Table UDFs. http://www.autoitscript.com/forum/index.ph...opic=11611&st=0

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

I'm wondering that if he uses hashes or arrays, how are changes going to be saved between executions of his script? I would suggest some sort of database if there are ever going to be additions/deletions of entries in your parts list

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Okay...

AutoIt isnt meant to be a database. Though it can be with the hash tables and arrays, it just isnt optimized for searching through that large of a need.

Excel is a spreadsheet. It is just a massive array. I would go with an actual database.

I have used MS Access to create a rather large database, and I believe it would suite your needs. I wouldnt recommend Access though.

I would recommend MySQL it is free and comes with a nice SQL command line utility that allows you to run searches on information in the database and return it to your AutoIt program. Basically what I would do if I were you is use MySQL as your backend and use AutoIt to manipulate the data in a GUI format. Similar to using VB and Access together.

Edit: DB Forums is a wonderful forum. It can give you all of the help you will ever need on SQL programming and the most popular databases out there.

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

How do you do today?  Do you have some database application or software in use today?  Have you tried AutoIT to sendkeys() and ControlClick() it?

Sounds like a job for a Visual Basic database, Microsoft Excel, or Access.

<{POST_SNAPBACK}>

Currently I don't do anything like what I want to do.

My program greatly improves the cycle time for my job; so while using it I have found ways to improve the quality of the product generated (audit tags, address labels, production labels and other documents). It took my cycle time from 5 minutes down to about 40 seconds (LEAN). A couple days before this topic was started, another shift entered (manually not scanning) the wrong customer part number, which is a MAJOR mistake. The product never made it out the door, but the problem is that it happened.

Through some thought, I came to the conclusion that, if it could verify that the part number entered has been used once before that it could allow it uninterupted. If the part number isn't on record it would alert the user so that we would have a chance at stop the mistake from getting off our desk. This isn't vital but has been made a priority of mine to get into the next version.

Sorry for the story.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

You could have it all in one TAB delimited file.

DS1050K{tabchar}30-2696050

DS1051S{tabchar}AXXPEDS1051S{tabchar}30-2696051{tabchar}DS1051S

DS1069K{tabchar}A-DS1069

use _FileReadToArray() to put it all in a one dimensional array

When the P/N is entered use _ArrayBinarySearch() to search the array for the P/N in question.  When found, use StringSplit to put it in a secondary array for display.  It wouldn't matter whether you searched for Your P/N or a Customer P/N.  You'd get it fairly quick and you would have a cross-reference function with no additional programing.

Or I misunderstood the problem...

<{POST_SNAPBACK}>

Would you be able to go a little bit more into detail on this. The text file that I pulled out of MFG/Pro is suitable for this.
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...