@ Villeroy
You wrote "The code is most simply designed to work ..." to which I can conclude, yes it is deigned to work, but I do not think it is simple.
I am a rooky as to macro development with calc, but have some experience in object orientated scripting and programming. Most of the information in respect of macro I have is from you. (Like the VVJOIN and CELL_functions)
I was looking at developing a sorting function (when querying the internet on that topic I did not get to this posting), because most objects I work with has some significance in respect of order, however, they are created in a random manner. Therefore it is most useful to have the data sorted when disseminating the information so that an ordered sequence can be followed.
The built in functions works for all situations, however it is manually driven in terms of seting up the models and for refreshing the sorting. (As far as I know).
I have been following the macro examples of chapter 12 of the Calc Guide (expecially the very last one on sorting) and got a more customized version working as a sub-routine macro that is run from the menu or by clicking a custom button assigned with the macro. All variables are hard coded within the sub-routine.
The macro contains uno services, a cell range, and then sorts on one of the uno functions available to a range. The uno Object Model is still foreign to me.
Then I tried to use the same code to develop a function that would execute these actions, to no avail. The function would run completely, but the data on the sheet is not updated. There is nothing wrong with the code itself, because of it being an exact copy of the sub-routine that works.
My next idea was to triger the sub-routine from inside the function, but this still did not work.
I was under the impression that triggering the execution of a sub-routine can be done by various ways and the result would be similar in all cases.
I stumbled upon this posting as a result of a search into "how to simulate a button event" in order to find a way to trigger the sub-routine automatically. It seems both cheros and myself are maybe confused as to the execution requirements for running a sub-routine automatically.
The lists are not static and need constant updating and re-sorting which may result in a missed procedure.
Your solution in respect of the url sorting seems to be the perfect answer. If I understand correctly, the method followed can be dynamically maintained for any of the parameters especially the size of the array.
I only have one problem, how do I fire the soring in a dynamic manner, whithout physically clicking on the hyperlink.
As stated above, I was under the impression that such an event can be triggered within a function, so when the function updates, it triggers the sort sub-routine and voi la the sorting is dynamic.
The other solution that works sort of is the following sequence:
1. List of data is parsed as an array into a function taking a range
2. Assign the array as cellrange, sort it inside the function
3. Produce the result as an array back to the sheet
The problem, as I understand, is that when an array is returned to the sheet, the sheet reserves some sort of are for it in protecting it from being erroneously deleted etc. Then when the list grows double its size, half of the list is not accessible. Therefore, I would like a dynamically managed list without restricting the length beyond what was setup.
Could you perhaps comment on this rather complicated concept to a novice.
LibreOffice 3.4 on uBuntu 10.11 and LibreOffice 3.5 on Windows 7 Professional (32 bit) (2.4.3 until October 2009)
Don't kil time.