Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
19
Erster Beitrag:
vor 2 Jahren, 9 Monaten
Letzter Beitrag:
vor 2 Jahren, 9 Monaten
Beteiligte Autoren:
kimor, Marc De Swert, DerekT, heinz kuebler, Al, Viggo Poulsen, GuenterP, Fabrice Harari

[Solved] [WD20/19] Search result problem with V and W

Startbeitrag von kimor am 17.05.2015 15: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

Antworten:

Re: WD20/19 Search result problem

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

von DerekT - am 17.05.2015 18:50

Re: WD20/19 Search result problem

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

von kimor - am 18.05.2015 05:54

Re: WD20/19 Search result problem

Hi kimor, the HReadSeekFirst( ... ) is essential, alternatively you can add the hIdentical option ...

von GuenterP - am 18.05.2015 06:46

Re: WD20/19 Search result problem

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.

von DerekT - am 18.05.2015 09:53

Re: WD20/19 Search result problem

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

von kimor - am 18.05.2015 17:38

Re: WD20/19 Search result problem with V and W

Can you give an description of the User file?
Is the field logon where you looking in not an Unike keyfield?
marc

von Marc De Swert - am 19.05.2015 09:30

Re: WD20/19 Search result problem with V and W

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

von kimor - am 19.05.2015 10:54

Re: WD20/19 Search result problem with V and W

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).

von DerekT - am 19.05.2015 12:05

Re: WD20/19 Search result problem with V and W

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

von Viggo Poulsen - am 19.05.2015 14:14

Re: WD20/19 Search result problem with V and W

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

von Fabrice Harari - am 19.05.2015 15:45

Re: WD20/19 Search result problem with V and W

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

von kimor - am 20.05.2015 05:56

Re: WD20/19 Search result problem with V and W

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

von Al - am 20.05.2015 06:33

Re: WD20/19 Search result problem with V and W

Hi Al,

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


Regards
/Kim

von kimor - am 20.05.2015 07:29

Re: WD20/19 Search result problem with V and W

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:

von Marc De Swert - am 20.05.2015 07:47

Re: WD20/19 Search result problem with V and W

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:

von Marc De Swert - am 20.05.2015 07:54

Re: WD20/19 Search result problem with V and W

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 send me the example at: PM
And I will have a look...


Regards,
/Kim

von kimor - am 20.05.2015 09:36

Re: WD20/19 Search result problem with V and W

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

von heinz kuebler - am 20.05.2015 13:35

Re: WD20/19 Search result problem with V and W

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 string. I changed it to String.

Thanks to everyone that helped!


Regards,
Kim

von kimor - am 22.05.2015 20:15
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.