After years and years I've figured something out

  1. 6 months ago

    Russ L

    5 Jan 2019 Pre-Release Testers, Xojo Pro

    I've never been happy with XOJO recordsets as they seemed to sometimes return the wrong columntype

    I was looking in the LR for the field types and its just clicked why that was.

    idxfield is one based and columntype is zero based !

    10 YEARS! 10 YEARS I've struggled to figure that out! AAARGHH!

  2. Markus W

    5 Jan 2019 Pre-Release Testers #JeSuisHuman New Zealand, Auc...

    … I still haven‘t …

    ;-)

  3. Just made that idxfield error again :(

  4. Bob K

    7 Jan 2019 Pre-Release Testers, Xojo Pro Kansas City

    There are only a few instances in Xojo where things are 1 based rather than zero. FolderItem.Item and Recordset.idxField are the two that consistently bite developers. I'm sure there are others but those are the most common, IMO.

  5. Kem T

    7 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Connecticut

    InStr and NthField too, technically.

  6. Russ L

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    seems I'm not the only one!

    nice to be in such good company :-)

  7. Beatrix W

    8 Jan 2019 Pre-Release Testers Europe (Germany)

    I always wait until I get an OutOfBoundsException.

    The real problem is getting left and right. Some of the time "driver side" and "passenger side" works. But not always.

  8. Eric W

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    I guess things that were 1-based in VB are so in Xojo for compatibility.

    I got bitten the other day working with MidB around Memory Block StringValues!

  9. Emile S

    8 Jan 2019 Europe (France, Strasbourg)

    @Bob K things are 1 based rather than zero. FolderItem.Item

    It was 0-based in REALbasic (Real Studio ?)

  10. Eric W

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    Re FolderItem: Anything with a Count property will be 1-based for sure.

  11. Kem T

    8 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Connecticut

    The good news is, part of API 2.0 is making everything zero based for consistency.

  12. Christian S

    8 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    @Kem T The good news is, part of API 2.0 is making everything zero based for consistency.

    I hope without breaking code.

  13. Kem T

    8 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Connecticut

    Based on past experience, they won't, which means new functions/methods and deprecating the old.

  14. Eric W

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    [Hobby-horse warning] Well For...Next (which I don't like anyway) seems premised on 1-based in relation to Count properties, otherwise it will have to be Count-1 all the time. Another good reason to avoid For...Next.

  15. Kem T

    8 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Connecticut

    You're quite mad, you know...

  16. Daniel T

    8 Jan 2019 Pre-Release Testers, Xojo Pro
    Edited 6 months ago

    If I could wish one change into Xojo's history it would be this:

    • 0-based across the entire framework.
    • Optional named 1-based variants.
    • Optional compiler warning regarding said 1-based variants.

    So RecordSet.IdxField and RecordSet.IdxFieldOne (or IdxFieldBaseOne or something). That would allow you to port code from older basic systems (i.e. VB) using a simple find/replace but leaving you with a clear delineation as to old 1-based code that should be updated/made consistent.

  17. Daniel T

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    @Eric W [Hobby-horse warning] Well For...Next (which I don't like anyway) seems premised on 1-based in relation to Count properties, otherwise it will have to be Count-1 all the time. Another good reason to avoid For...Next.

    One of the things I like about C is that its for statement gives you clear, explicit, easy to read control over this.

  18. Eric W

    8 Jan 2019 Pre-Release Testers, Xojo Pro

    Well it's 1AM here and I'm still coding so I'm probably a little crazy by now. But my favourite with arrays goes like this:

    Do until arr.ubound = -1
       x = arr.Pop
       ...
    Loop

    No house-keeping. Love it.

  19. Newer ›

or Sign Up to reply!