Welcome! Log In Create A New Profile

Advanced

list box filter question

Posted by Hans60 
Hans60
list box filter question
February 24, 2009 01:54PM
I have a list box on the left displaying the ID of a user
on the right side I like to show selected user but ther I would like to FIRST LASTNAME

<a href=http://www.freeimagehosting.net/><img src=http://www.freeimagehosting.net/uploads/08314c5df7.gif border=0 alt="Free Image Hosting"></a>


how is this done and will I need to modify this code or is ther another way?
Thanks for any Help!

------------------CODE--------------------------------------
nSubscript is int

// For each row selected in list 2
FOR ALL SELECTED ROW nSubscript OF LIST_multi1
// If the selected element is not found in list 3...
IF ListSeek(LIST_multi2,LIST_multi1[nSubscript])=-1 THEN
// ... add it
ListAdd(LIST_multi2,LIST_multi1[nSubscript])
END
END
-----------------------------------------------------------------------

Marc De Swert
Re: list box filter question
February 26, 2009 10:39AM
Hi Hans,

if your left list only have the UserID's
then you have to search for the first, lastname and whatever you want on to show
thru the UserID before you can do the listadd

marc :cool:
Piet van Zanten
Re: list box filter question
February 26, 2009 11:11AM
Hi Hans,

You can use gLink for this purpose. In the editor you check the details tab, use the value returned by glink.
Then adapt your code as follows:

nSubscript is int 

gLinkActivate(LIST_multi2)

// For each row selected in list 2 
FOR ALL SELECTED ROW nSubscript OF LIST_multi1 
    // If the selected element is not found in list 3... 
    IF ListSeek(LIST_multi2,LIST_multi1[nSubscript])=-1 THEN 
        // ... add it 
        // do HreadSeekFirst to get the name
        ListAdd(LIST_multi2,MyFile.Name+", "+MyFile.FirstName+glink(LIST_multi1[nSubscript]))
    END 
END
Now list 2 will display the names and return the ID.

Regards,
Piet
Hans60
Re: list box filter question
February 28, 2009 01:01PM
Hi Piet,
it works and it helps me to understand WinDev a bit further.Many thanks for your Help! There is however a small problem the above code moves only first record if multy IDs are selected it will add the same name multy times. It adds the top contact only.

<a href=http://www.freeimagehosting.net/><img src=http://www.freeimagehosting.net/uploads/434a51e0f5.gif border=0 alt="Free Image Hosting"></a>
Piet van Zanten
Re: list box filter question
March 01, 2009 08:47PM
Hi Hans,

LIST_multi1 should return the employee ID. If the list is based on an automatic browse then it has to return the employee ID. You can set this in the content tab, stored item. If List 1 is a memory list you can use gLink in a similar way as List 2 so that it returns the ID.
Then
hreadseekfirst(MyFile,MyID,LIST_multi1[nSubscript])
should work.

HTH regards,
Piet
Hans60
Re: list box filter question
March 01, 2009 11:09PM
List 1 has "File with direct access" and displayes Employee ID and is stored item and multy select as you describe and it still adds same contact multy times even though different IDs are selected. Have a look at this screen shot [www.freeimagehosting.net]
Piet van Zanten
Re: list box filter question
March 02, 2009 10:53AM
Hi Hans,

Can you post your code?
Try to set a breakpoint on the hreadseekfirst and check the value of the empl.ID.

Regards,
Piet
Hans60
Re: list box filter question
March 02, 2009 03:01PM
Hi Piet,
I found it, missed a small detail. It works now!
Many Thanks!
Hans
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: