Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

DBServer:OrderSkipUnique not working? 09 Sep 2022 15:13 #23720

  • Kai
  • Kai's Avatar
  • Topic Author


  • Posts: 37
  • 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:\xsharp\tmppos.dbf", DBSHARED, FALSE, "DBFCDX"}
    oDBServer:SetIndex("c:\xsharp\tmppos.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:

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 09 Sep 2022 15:40 #23722

    • FFF
    • FFF's Avatar


  • Posts: 1377
  • 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 (X# 2.13.0.6; Xide 1.32; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Last edit: by FFF.

    DBServer:OrderSkipUnique not working? 09 Sep 2022 15:59 #23724

    • Kai
    • Kai's Avatar
    • Topic Author


  • Posts: 37
  • 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

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 09 Sep 2022 17:15 #23728

    • Chris
    • Chris's Avatar


  • Posts: 3650
  • 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:
    FUNCTION Start() AS VOID
    LOCAL nDirection := NIL AS USUAL
    LOCAL cFileName AS STRING
    LOCAL n AS INT
    
    cFileName := "c:\dbf\SkipUnique"
    
    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()

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 09 Sep 2022 17:27 #23729

    • FFF
    • FFF's Avatar


  • Posts: 1377
  • 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 (X# 2.13.0.6; Xide 1.32; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 09 Sep 2022 17:34 #23731

    • Chris
    • Chris's Avatar


  • Posts: 3650
  • 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 ;)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 10 Sep 2022 10:44 #23743

    • Kai
    • Kai's Avatar
    • Topic Author


  • Posts: 37
  • 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

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 10 Sep 2022 16:48 #23751

    • Chris
    • Chris's Avatar


  • Posts: 3650
  • Hi Kai,

    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?

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    DBServer:OrderSkipUnique not working? 10 Sep 2022 17:15 #23753

    • Kai
    • Kai's Avatar
    • Topic Author


  • Posts: 37
  • 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.

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1