PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio â†’ WINDEV 2024 â†’ WD20/19 Search result problem
WD20/19 Search result problem
Iniciado por guest, 17,may. 2015 17:28 - 18 respuestas
Publicado el 17,mayo 2015 - 17:28
Hi,

I've got a populated combo box with user id and user names.
When you choose a name in the list, a search is made in the user table and when it finds the user the fields are populated
with the rest of the user information.

The problem is that when a search is made for xxxxw it finds xxxxv instead and populates with that information instead.
I've tried different options and searches and it ends up the same even if the search result should be exact..

code of the combobox:
IF HReadSeek(Users, Logon, Edt_id) = True THEN
Edt_Name = Users.Name
Edt_Mail = Lower(Users.mail)
ELSE
Edt_Name = ""
Edt_Mail = ""
Info("The user doesn't exist.")
RETURN
END


Any great ideas?

Regards
/Kim
Publicado el 17,mayo 2015 - 20:50
HReadSeekFirst(Users, Logon, Edt_id) = True THEN
If Hfound(Logon) = True THEN
Edt_Name = Users.Name
Edt_Mail = Lower(Users.mail)
ELSE
Edt_Name = ""
Edt_Mail = ""
Info("The user doesn't exist.")
RETURN
END
Publicado el 18,mayo 2015 - 07:54
Hi Derek,
That didn't work either. I already tried that.
It seems that I need the Complete function, or?
Tried the code below:

IF HReadSeek(Users, Logon, Complete(Edt_id.COL_id..DisplayedValue, 6)) = True THEN
IF HFound(Users) = True THEN
Edt_Name = Users.Name
Edt_Mail = Lower(Users.mail)
ELSE
Edt_Name = ""
Edt_Mail = ""
Info("The user does not exist!")
RETURN
END
END


Doesn't work either. Any ideas?
The problem is that V and W is interpeted the same.


Regards,
/Kim
Publicado el 18,mayo 2015 - 08:46
Hi kimor, the HReadSeekFirst( ... ) is essential, alternatively you can add the hIdentical option ...
Publicado el 18,mayo 2015 - 11:53
Kimor

What value is returned by Edt_id?
How are you filling your combo with data?

Only guessing at the moment but check ouit 'gLink' in the Help - it may be that you need this when filling the combo.
Publicado el 18,mayo 2015 - 19:38
Hi Derek,

The userid.
Thru a file and a query. There are two fields in the Combo box.

There shouldn't be any problem with filling the box or finding results. Other than the example with W and V it seems to work. It's how the search finds the userid with V at the end and the search is done with W.


I'm not sure how the glink would work.

Regards
/Kim
Publicado el 19,mayo 2015 - 11:30
Can you give an description of the User file?
Is the field logon where you looking in not an Unike keyfield?
marc
Publicado el 19,mayo 2015 - 12:54
Hi Marc,

The user file consist of five columns:
Userid (text Unique)
Username (text)
e-mail (text)
Administrator (boolean)
Group (text)

So, yes the UserId is unique as it should be.


Regards,
/Kim
Publicado el 19,mayo 2015 - 14:05
Kimor
Still insufficient information.....

From you description I am assuming your combo is of a Table type.
If this is the case then gLink would enable you to specify the 'Stored Value' as the Userid for using in the search.

If not can you describe what the combo is displaying and waht you have set as the 'Stored Value' of the combo.


You still appear to be using HReadSeek
From the Help......

HReadSeek - Positions on the first record of a data file whose value for a specific item is greater than or equal to a sought value (generic search).

HReadSeekFirst - Positions on the first record of a data file whose value for a specific item is strictly equal to a sought value (exact-match search).
Publicado el 19,mayo 2015 - 16:14
Hi Kimor and Derek

When using HReadSeekFirst you have to remember checking Hfound afterwards. If no record corresponding to the condition exists but if a record with a greater value is found: the record is read and HFound returns False.

Best regards
Viggo Poulsen
Publicado el 19,mayo 2015 - 17:45
Hi everybody

or you can just continue to use hreadseek (which I use all the time) and use the hidentical option that will return to you ONLY what you want

Best regards
Publicado el 20,mayo 2015 - 07:56
Hi,

"Derek:
The ComboBox is of tabletype"


I tried these options before with no success:
IF HReadSeek(Users, Logon, Edt_id.COL_id..DisplayedValue,hIdentical) = True THEN
IF HFound(Users) = True THEN
Edt_Name = Users.Name
Edt_Mail = Lower(Users.mail)
ELSE
Edt_Name = ""
Edt_Mail = ""
Info("User was not found!")
RETURN
END
END



or

IF HReadSeekFirst(Users, Logon, Edt_id.COL_id..DisplayedValue) = True THEN
IF HFound(Users) = True THEN
Edt_Name = Users.Name
Edt_Mail = Lower(Users.mail)
ELSE
Edt_Name = ""
Edt_Mail = ""
Info("User was not found!")
RETURN
END
END

Both these will find S102SV instead of S102SW which is the sought value.
V & W are interpeted in some searches as the same letter, which seems to be the case here.
So the search is not exact.

Is there some other way to search the file?


Regards,
/Kim
Publicado el 20,mayo 2015 - 08:33
Hello Kim

Just a minor point, you don't need HFound() if you are testing the seek using IF Hreadseek()

Try adding glink(Userid) to the combobox fill and then retrieve the ..storedvalue and search for that using the Userid index on the file.

Regards
Al
Publicado el 20,mayo 2015 - 09:29
Hi Al,

I havn't used the GLink function before, but I'll try to figure it out...


Regards
/Kim
Publicado el 20,mayo 2015 - 09:47
Hello Kim

The user file consist of five columns:
Userid (text Unique)
Username (text)
e-mail (text)
Administrator (boolean)
Group (text)

is the field Userid not named Logon? because that is what you refer in the first ask


so...
i did an test and create an file Users with the follwong fields:
file: Users
Logon text (6) Unique key
Username text (50)
e_mail text (100)
Admin boolean
Group text (50)

filled with
S102SD FLUP FLUP@YO.BE
S102SV FLIP FLIP@YO.BE
S102SW FLOP FLOP@YO.BE

created 2 editfields en 1 combo
Fill the combo with the 2 fields Logon and Username

then in the COMBO_USER in the section "Selecting a row of COMBO_USER"
IF HReadSeekFirst(Users, Logon, COMBO_User.COL_Userid, hIdentical) = True THEN
IF HFound(Users) = True THEN
EDT_Name = Users.Username
EDT_Mail = Lower(Users.e_mail)
ELSE
EDT_Name = ""
EDT_Mail = ""
Info("User was not found!")
RETURN
END
END

all, the fields are filled without any problem

i think that you misspeld here and there some names en referer to the wrong fields

every time i change the combo all the fileds are correct filled

Marc :cool:
Publicado el 20,mayo 2015 - 09:54
Kimor

if you like give me your email and i will send you my testprogramm
so that you can check how it's work

Marc :cool:
Publicado el 20,mayo 2015 - 11:36
Hi Marc,

Thanks for the input!

The column is called Logon but is UserID as well, so the search is in the Logon column.

It's strange if there is something not refered right since all other users work (since Oct 2013).

But you can sende me example at: PM
And I will have a look...


Regards,
/Kim
Publicado el 20,mayo 2015 - 15:35
maybe a mismatch of fields (names? ) or a problem with different lengths ?

e.g. if windev search with S102S (instead of S102SW) it will always find S102SV

regards, Heinz
Publicado el 22,mayo 2015 - 22:15
Hi,

Finally I found the problem.
It was a setting in the Description of the items and the indexes of a data file , where the Sub type of the logon item was set to Unicode. I set that to string.

Thanks to everyone that helped!


Regards,
Kim