DBServer:OrderSkipUnique not working?

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

DBServer:OrderSkipUnique not working?

Post by Kai »

Hello everyone!

It sems that DBServer:OrderSkipUnique() is not working. I wrote the following code for testing:

METHOD ButtonTest AS VOID PASCAL
LOCAL oDBServer AS DbServer
LOCAL oTB AS TextBox

oDBServer := DbServer{"c:xsharptmppos.dbf", DBSHARED, FALSE, "DBFCDX"}
oDBServer:SetIndex("c:xsharptmppos.cdx")
oDBServer:SetOrder("TischNr")
oDBServer:GoTop()

WHILE !oDBServer:EOF
oTB := TextBox{, "test", NTrim(oDBServer:fieldget("bTischNr")) + CRLF + NTrim(oDBServer:RecNo)}
oTB:Type := BUTTONYESNO
IF oTB:Show() == BOXREPLYNO
EXIT
ENDIF

oDBServer:OrderSkipUnique()
ENDDO

oDBServer:Close()


It allways shows :
-1000
14501

The OrderSkipUnique() function does not appear to be executed.
I recreated the cdx file but it still didn't work.
The .dbf and the .cdx are in the attachments.

Regard
Kai
Attachments
TMPPOS.zip
(247.51 KiB) Downloaded 48 times
FFF
Posts: 1527
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

DBServer:OrderSkipUnique not working?

Post by FFF »

Kai,
didn't know this method ;-)
But what do you expect. After GoTop, your TischNr is "1" - the next TischNr, which is NOT 1, is -1000, and this in record 14501. Behind this record no ofter TischNr exists. So, for my eyes, the result is correct.

BTW, wouldn't hurt to first check with and the provide a sample dbf with a bit less records ;-)
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

DBServer:OrderSkipUnique not working?

Post by Kai »

Hi Karl!

Sorry for the large amont of records.

For me after GoTop() bTischNr is -1000 and not 1. The correct ascending order is -1000, -1 since -1000 is less than -1

I Expect:

GoTop() bTischNr = -1000 / EOF = false
First OrderSkipUnique() bTischNr = -1 / EOF = false
Second OrderSkipUnique() EOF = true

In VO it works like this.

Regards

Kai
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer:OrderSkipUnique not working?

Post by Chris »

Hi Karl, Kai,

Indeed there's a problem here, OrderSkipUnique() fails to move to the next group of values or to eof if not one is found. Will log this for Robert to look into it and fix it, problem can be also reproduced as such:

Code: Select all

FUNCTION Start() AS VOID
LOCAL nDirection := NIL AS USUAL
LOCAL cFileName AS STRING
LOCAL n AS INT

cFileName := "c:dbfSkipUnique"

DbCreate(cFileName , {{"FLD","N",5,0}})
FErase(cFileName + ".cdx")

DbUseArea(,"DBFCDX",cFileName)
FOR n := 1 UPTO 10
	DbAppend()
	FieldPut(1, iif(n%2==0, 1 , 2))
NEXT
DbCreateIndex(cFileName, "FLD")
DbGoTop()

WHILE !Eof()
	? FieldGet(1) , RecNo()
	VoDbOrderInfo( DBOI_SKIPUNIQUE, "", NIL, REF nDirection )
ENDDO

DbCloseArea()
.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
FFF
Posts: 1527
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

DBServer:OrderSkipUnique not working?

Post by FFF »

Hi Kai,
sorry for the confusion, you are right, of course. To my defense, i looked in the dbf with a tool, to find out, what's in - so no SetOrder, then stopped thinking...
That's the difference between the gurus like Chris and noobs like me ;-)
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer:OrderSkipUnique not working?

Post by Chris »

It's just the difference that I'm paid money to investigate things like that, so I need to persist and fully investigate what's going on ;)
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

DBServer:OrderSkipUnique not working?

Post by Kai »

Hi Chris!

Thanks for reporting this issue to Robert.

I found another problem with DBServer:Seek(). The lLast Parameter seems to be ignored. Can you check this please if this issue is not known yet?

Regards
Kai
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer:OrderSkipUnique not working?

Post by Chris »

Hi Kai,
Kai post=23743 userid=4500 wrote: I found another problem with DBServer:Seek(). The lLast Parameter seems to be ignored. Can you check this please if this issue is not known yet?
In a small test case I wrote, this seems to work fine here. Can you please provide a sample showing the problem?

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

DBServer:OrderSkipUnique not working?

Post by Kai »

Hi Chris!

I wanted to make a small example but for some reason it works fine for me now too.

Sorry, I really don't know why? I'll work on it and let you know when I have something new. This morning I tested it several times and it never worked, and the only thing is, that I restarted the computer after lunch.
Post Reply