Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2006
    Location
    In a black hole
    Posts
    91

    Trying to search a .dat w/keywords

    Ran into a snag, as usual.

    My lame search process.
    I have a .dat file which contains some info, I don't think it's worthy of sqlite.

    Currently, I get Data from a combobox selection.

    Then the data (single word) is used in a String.Find process.
    It searches the value names of the .dat file and if the word is found that value name (title) and it's data is added to anther combobox.

    My problem is, beside the basic design, is that using only one word it limits the search results of the dat file. Using more then one word in the Data slot of the first combobox also causes limitations.

    What I think I should do is put a deliminated string of keywords in the data slot. BUT I can't seem to get the DelimitedStringToTable to work so I can cycle through each keyword. I keep getting errors using the script provided in ams. (scatches head)

    Any help, or new ideas, would be appreciated

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    What code are you using currently to perform your search? If you have a delimited string of words and you want to search that string for a key work you don't need to parse it to a table to be able to search it, you can you String.Find to see if your keyword exists in that string.

    HTH
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Jul 2006
    Location
    In a black hole
    Posts
    91
    Quote Originally Posted by TJ_Tigger View Post
    What code are you using currently to perform your search? If you have a delimited string of words and you want to search that string for a key work you don't need to parse it to a table to be able to search it, you can you String.Find to see if your keyword exists in that string.

    HTH
    Tigg
    Exactly what I am doing. But if I only use one word it misses a lot of other results. If I use more then one word it searchs for it as a phrase and misses a lot of results. So in my mind it needs to have search for each keyword separately to be accurate. Which is why I was thinking of running through a deliminated string. For some reason I could get that to work.

    Maybe it is a job for SQlite?

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    You could use SQLite, might make searches easier but you can use loops to do the same thing.

    for i,v in sectionsfromdat do
    for ii,vv in searchwords do
    if String.Find(v, vv, 1) ~= -1 then
    --was found mark it somehow maybe by putting it in another table
    break
    end
    end

    Something like the above would have a table of all the lines you wanted to search from the .dat file. Whether this is an ini or a text file. Then for each line in that file or the returned table, it will look through your search words. If one is found then you will need to mark it somehow maybe by putting it in another table that you can look at later.

    HTH
    Tigg

    P.S. If you can provide a copy of the file I can try to help with a working example.
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Oct 2005
    Location
    MI
    Posts
    524
    Can you post the structure of your .dat file?

    If your .dat file is just being used to store value pairs, it might be better to follow the .ini format. That way you could use the built-in AMS actions to search just the value names.

    If you had a dat file that looked like this:
    Code:
    [Root]
    Test One=some data...
    Test Two=some data....
    Test Three=some data.....
    Test Four=some data......
    Your code would look something like this (assuming you have added the "DelimitedStringToTable" function to your Global Functions and you are using listboxes to display the results.):

    Code:
    INI = "\\autoplay\\docs\\SearchMe.dat";
    
    -- clear the listboxes
    ListBox.DeleteItem("ListBox1", -1);
    ListBox.DeleteItem("ListBox2", -1);
    
    -- Get the Value Names from the dat file
    tbl_ValueNames = INIFile.GetValueNames(INI, "Root");
    
    -- Break the search text into individual words
    tbl_Search = DelimitedStringToTable(Input.GetText("Input1"), " ");
    
    -- Step through the Value Names
    for index, value in tbl_ValueNames do
    	-- for each Value Name, search for each search word
    	for index1, word in tbl_Search do
    		WordFound = nil;
    		WordFound = String.Find(value, word, 1, false);
    		if WordFound > -1 then
    			-- If found write the value name to the listbox
    			ListBox.AddItem("ListBox1", value, "");
    			-- And write the corresponding value to the listbox
    			ListBox.AddItem("ListBox2", INIFile.GetValue(INI, "Root", value), "");
    		end
    	end
    end
    Yeah right. Who's the only one here who knows the illegal ninja moves from the government?

    ()))))))))o)))))))==============================================

  6. #6
    Join Date
    Jul 2006
    Location
    In a black hole
    Posts
    91
    My Dat file is setup exactly how you posted.

    I'm trying to get a resizing script working, then going to try your idea. It sound and looks like it's what I need to do.

    Thanks for your time and reply.

    "I'll be back"

Similar Threads

  1. how to search for string over the whole project
    By Dimon in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 03-22-2006, 04:49 PM
  2. Listing search results in a listbox?
    By bobbie in forum AutoPlay Media Studio 6.0
    Replies: 17
    Last Post: 03-22-2006, 03:03 PM
  3. SQLITE Search on CD
    By perry_d76 in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 03-31-2004, 08:36 PM
  4. Cancelling File Search
    By pjborg in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 06-23-2003, 01:49 AM
  5. File Search
    By Jan Fr. Nordbakke in forum Setup Factory 5.0
    Replies: 0
    Last Post: 10-14-2001, 03:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts