Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6

Thread: Only add once

  1. #1
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617

    Only add once

    Here is what i have.
    Code:
    for nRow = 1, tReport.Rows do
    sLSU = tReport.Data[nRow]["ADPE_Account"]
    ComboBox.AddItem("Plugin1", sLSU, "");
    end
    i'm about postal with this one. how can i prevent it from entering the same text twice. in the column ADPE_Account is a list of whos account the item is on. so the account names could be in that column a hundred times. how can i only have it enter the account name one time.

    Chris

  2. #2
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Review this code I did here:

    Code:
    strSearchString = "Ace"
    
    numIsFound = ComboBox.FindItem("ComboBox1", LB_ALLITEMS, LB_BYTEXTDATA, strSearchString)
    
    if numIsFound == -1 then
    	ComboBox.AddItem("ComboBox1", strSearchString, "")
    		ComboBox.SetSelected("ComboBox1", 1)
    end
    Intrigued

  3. #3
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    Thanks Intrigued! this what i did to it.

    Code:
    for nRow = 1, tReport.Rows do
    	sLSU = tReport.Data[nRow]["ADPE_Account"]
    	numIsFound = ComboBox.FindItem("Plugin1", LB_ALLITEMS, LB_BYTEXTDATA, sLSU)
    	if numIsFound == -1 then
    	ComboBox.AddItem("Plugin1", sLSU, "")
    	end
    	end
    i was looking at just concating sLSU to itself each time and run a string.find on the new string to see if its a duplicate. i figured that would get messy. your way is much better.

    Thanks again!

    Chris

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Not a problem stickck, glad it "get-r-done" for ya.

    Intrigued

  5. #5
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Chris,

    Could you modify your query to return only the DISTINCT entries within a particular column?

    SELECT Statement

    I don't know what you are ultimately trying to do but you could perform a

    SELECT DISTINCT ADPE_Account from tablename

    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

  6. #6
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    I run the query to create tReport table and then use that table several times throughout the project. I would just requery the DB but i'm trying to keep the queries to a minimal because there will be multiple users (Maybe 5 at a time) using this program at any given time.

    That script i posted above works perfect. i also use something very similar for the HTML reports page also.

    Thanks for the help. i might be able to use that in another place though.

    If you want to see the project, here's the link

    http://www.box.net/public/h6m5d5bryj It's in AMS 5 since that's what I have at work.

    Chris

Similar Threads

  1. How to add a folder to setup?
    By anilthomas26 in forum Setup Factory 7.0
    Replies: 1
    Last Post: 04-27-2005, 12:08 PM
  2. Add INI Value Help
    By nolazabal in forum Setup Factory 6.0
    Replies: 7
    Last Post: 07-08-2003, 08:50 AM
  3. HOWTO: Add DirectX 8.1 Support to your Setup Factory 6.0 Installation
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-30-2002, 01:55 PM
  4. Add to Path Function and change form colors/text
    By Tnygaard in forum Setup Factory 6.0
    Replies: 0
    Last Post: 07-21-2002, 08:31 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