Jump to content

UBound vs IE.au3 & SQLite.au3


SKaLVaRo
 Share

Recommended Posts

Hi,

I got puzzled by the following:

In the AutoIt helpfile for UBound there is an example script on how to use it.

Dim $myArray[10][20]   ;element 0,0 to 9,19
$rows = UBound($myArray)
$cols = UBound($myArray, 2)
$dims = UBound($myArray, 0)oÝ÷ غw^®ËZÛaËayø«²×béìâ²Ø^ßÚèÃ]g§²*'jwmërÝ¢w­íýrn]g§²*'È«·½êíâM¦åyjâµäèºÚÉû§rبÈhÂÆ®¶­sdÆö6Âb33c¶õF&ÆT6VÆÇ5²b33c¶ö6öÇ5Õ²b33c¶÷&÷w5ÐoÝ÷ Ù*-+"²Ø^{ޮǨ~Ø^P.×îËb¢p'u$×»{!£¢´.+^+)¬¶
¬º[ZºÚ"µÍÜ   ÌÍÚPÛÛHÈPÝ[
    ÌÍØTÝ[JHHBÜ    ÌÍÚTÝÈHÈPÝ[
    ÌÍØTÝ[HH
So again the inverse of the UBound function.

Which of the two can be considerd the right one because mixing these up can get very confusing for a starter as I am.

I stumbled upon these anomalies as I am working on a little project that gathers info from a website, hence IE.au3, and places them into a database, here comes SQLite.au3. Since I need to know the excact dimensions of the tables returned from various functions of both UDF I would like to know what is the right method for using UBound in regards to the dimensions of tables.

Is the example for UBound wrong? Is there a rule, or concensus, that explains which dimension should be considerd as 'row' and which one as 'colum'? If so I would like to know because otherwise I could get strange results when using one method and calling a function of a UDF that uses another method.

Thanks for looking into this,

SKaLVaRo (just a beginner)

Link to comment
Share on other sites

Well It is kinda up to you :whistle: But deside which you use :)

OK. Thank you for replying.

But just one question. What is the standard way this is being used in the different UDFs? I ask this so I can adept that way of working and I don't have to worry anymore about getting strange results because one UDF function uses one way of dealing with this and a second one uses another.

For now I will change the code I already have in using the way it is used in IE.au3 and SQLite.au3.

Shouldn't there be a guideline for these issues when making UDFs? Especially when those UDFs are to be included in a major release. Or is there already such a guideline which I haven't found yet?

Link to comment
Share on other sites

Arrays do not inherently have a concept of rows and columns, only dimensions. You'll note that it is only the example for Ubound that mentions rows and columns, not the core function documentation.

AutoIt arrays can have up to 64 dimentions (and Ubound knows how to address them all) -- which dimensions are rows and which are columns? Buckaroo Bonzai may be able to help you visualize up to 8 dimensions, but your're on your own after that :-)

I suggest that simply read the documentation and write yourself a simple Array-Transpose function if it is causing you grief.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thank you all for replying,

I will adjust my way of working with, and thinking of, tables from rows and columns (the M$ Excel way :whistle:) to the more universal dimension thinking.

So for now I am going to look through my code and change things a bit so I have a clear way of working with arrays which I will try to keep up in this and future projects.

Thanks again for sharing your thoughts on this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...