2008/10/9 Cor Nouws <[EMAIL PROTECTED]>

> Hi Johnny,
>
> Johnny Rosenberg wrote (8-10-2008 18:43)
>
>> I know that there are no "two dimensional arrays" in OpenOffice.org Basic,
>> but rather arrays of arrays, but that is kind of what this problem is all
>> about. I have an array like this:
>>
>
> Well, it is no problem to have two dimensional arrays in OOo. But I think
> the DataArray is just a special structure.

Yes, I think you are right, I was just thinking too fast…

>
> I did have a look at your question, but do not see anything out of my
> experience that can be of help.
>
> Sorry for this,
> Cor

Don't be… it seems like no one else has a solution neither… But I think that
DataArray structure is a bit odd, because if I create a combo box on a
spreadsheet, rather than in a dialogue, I can associate it directly with a
cell range of one column, can't I? How does that work?
Just found out that I can't unless I register the cell range as a database,
but it was possible to do this without a database registration in an earlier
version, like 1.1.5 or so, I think.
J.R.


>
>
>
>
>>
>> StringArray=ThisComponent.Sheets.getByName("Example").getCellRangeByPosition(1,1,1,101).getDataArray()
>>
>> I want to use the data of a single column to add to a combo box.
>> Unfortunately the data in String Array is organized "the wrong way", so I
>> can't use the addItems function of the combo box to put the whole array in
>> there in only one step. I figured that would be a quick way to fill a
>> combo
>> box, wouldn't it?
>>
>> However, the StringArray then have to be "transposed". In this example,
>> looking at it in the Watch window, it could look like this:
>>
>> StringArray(0)(0)="Test"
>> StringArray(1)(0)="Text"
>> StringArray(2)(0)="Albatross"
>> …and so on.
>>
>> So now, I have to bring all one-element-arrays out of the big array one by
>> one in a loop, which is time consuming. If the array looked like this, it
>> would be way easier and quicker:
>>
>> StringArray(0)(0)="Test"
>> StringArray(0)(1)="Text"
>> StringArray(0)(2)="Albatross"
>> …and so on.
>>
>> Then I just had to bring the whole array out from StringArray(0) and then
>> I
>> could just bring the whole resulting array directly to the combo box,
>> without any loops what so ever.
>>
>> So it seems like I need a transpose function, making rows into columns. If
>> I
>> create one myself in OpenOffice.org Basic, the function will probably be
>> time consuming enough to make it meaningless, so my hope is now that there
>> already is such a function built into the system and that it's very fast
>> (for example, the built in search function seems to be very much faster
>> than
>> a function created by myself in OpenOffice.org Basic that does the same
>> job
>> would be, no matter how smart I am).
>>
>> Or maybe there is a way to bring out a one dimensional array from a single
>> column? If there was, I think I should have found it myself, but maybe it
>> has a strange name or something… I would imagine something like this (and
>> now I am just making it up):
>>
>>
>> StringArray=ThisComponent.Sheets.getByName("Example").getColumnByPosition(1,1,101).getDataArray()
>>
>> This would, if it existed, mean that StringArray would contain all data
>> from
>> column 1, row 1 until 101.
>>
>> Maybe there are other smart solutions for this? Anyone?
>>
>> J.R.
>>
>
>
> --
> "The Year of 3" -2008- "Het jaar van 3"
>
> Cor Nouws - Arnhem - Netherlands
>  > marketing contact - http://nl.OpenOffice.org
>  > Zeker van OpenOffice.org - www.nouenoff.nl
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to