Bug 89803 - Macros: BubbleSortList doesn't sort correctly.
Summary: Macros: BubbleSortList doesn't sort correctly.
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.2.8.2 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks:
 
Reported: 2015-03-03 14:16 UTC by Olaf Hautow
Modified: 2017-08-30 19:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Macro of BubbleSortList_2 (4.67 KB, text/plain)
2015-03-03 14:16 UTC, Olaf Hautow
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Hautow 2015-03-03 14:16:27 UTC
Created attachment 113851 [details]
Macro of BubbleSortList_2

Dear Madam or Sir, 
First I would like apologize for my faulty English but I am learning yet. 
I hope you understand me even so.
In Libre-Office Macros/Tools/Strings exists the macro "BubbleSortList". 
I'm afraid isn't right the result of this macro. Words wich begins with little letters and/or umlauts won't be sorting imprecisely.
Libre-Office sorted correct.
The reworked tool "BubblesortList_2" produces the same list like Libre-Office.
In accordance with the orthography regulations will handle umlauts like not umlauted vowels.
This function BubbleSortList_2 sorts an array it's no matter how many fields.
The array will sort after the field wich number's as second parameters hand over.
The default sorting order is the first dimension (sortfield is missing or sortfield = 0)
Function BubbleSortList_2(ByVal SortList(), optional sortfield) 
'This function BubbleSortList_2 sorts an array it's no matter how many fields. 
'The array will sorted after the field with number of sortfield start by 0. 
'The default sorting order is the first dimension (sortfield is missing or sortfield = 0) 
	Dim s As Integer 
	Dim t As Integer 
	Dim i As Integer 
	Dim k As Integer 
	Dim Field As Integer 
	Dim DisplayDummy 
	Dim Dummylist(0) As String 
	Dim Dummylist2(0,2) As String 
	Dim InitialASC As Integer 
	Dim Initialletter As String 
	Dim dimension As Integer 
'Test dimension 
	On Local Error GoTo ErrorDim 
	dimension = - 1 
	Do 
		dimension = dimension + 1 
		Initialletter = SortList(0,dimension) 
	Loop Until Err > 0 
	ErrorDim: 
	If Err = 9 Then 
		dimension = dimension - 1 
	Else 
		If Err = 6 Then 
			dimension = 1 
			sortfield = 0 
		End If 
	End If 
	If Ismissing(sortfield) Then 
		Field = 1 
	Else 
		If Isnumeric(sortfield) Then 
			If sortfield = 0 Then 
				Field = 0 
			Else 
				Field = sortfield 
			End If 
		Else 
		'On account of compatibility to original BubbleSortList 
		'That is to say if sortfield = true 
			If LCase(Sortfield) = "true" then 
				Field = 1 
			Else 
				Field = 0 
			End If 
		End If 
	End If 
	If Field > dimension And dimension > 0 Then 
		Msgbox(Error(9)) 
		Stop 
	End If 
	ReDim Dummylist(UBound(SortList())) As String 
	If dimension < 2 Then 
		ReDim DummyList2(UBound(SortList()),2) As String 
	Else 
		ReDim DummyList2(UBound(SortList()),dimension+1) As String 
	End If 
'The information which requisite to sort will broadcast in this loop 
	For i = 0 To UBound(SortList()) 
		If dimension = 0 Then 
			Dummylist2(i,1) = SortList(i) 
		Else 
			If SortList(i,Field) = "" Then 
				Dummylist2(i,1) = "zzz" & SortList(i,Field-1) 
			Else 
				Dummylist2(i,1) = SortList(i,Field) 
			End If 
		End If 
	'Data set number 
		DummyList2(i,2) = i 
	Next 
'From here will only use array Dummylist2 
	For i = 0 To UBound(Dummylist2()) 
		Initialletter = Dummylist2(i,1) 
		If Initialletter <> "" Then 
			InitialASC = ASC(Mid(Dummylist2(i,1),1,1)) 
		'Initialletter exchange and with the rest put together 
			Select Case InitialASC 
				Case 192 To 198, 224 To 230	'À, Á, Ã, Ä, Å, Æ, à, á, â, ã, ä, å, æ
				Initialletter = "a" 
				Case 199, 231	'Ç, ç
				Initialletter = "c" 
				Case 200 To 203, 232 To 235	'È, É, Ê, Ë, è, é, ê, ë
				Initialletter = "e" 
				Case 204 To 207, 236 To 239	'Ì, Í, Î, Ï, ì, í, î, ï
				Initialletter = "i" 
				Case 208, 240	'Ð
				Initialletter = "d" 
				Case 209 , 241	'Ñ
				Initialletter = "n" 
				Case 210 To 214, 242 To 246	'Ò, Ó, Ô, Õ, Ö, ö, ò, ó, ô, õ, ö
				Initialletter = "o" 
				Case 217 To 220, 249 To 252	'Ù, Ú, Û, Ü, ù, ú, û, ü 
				Initialletter = "u" 
				Case 221, 253	'Ý, ý
				Initialletter = "y" 
				Case Else 
				Initialletter = LCase(Mid(Dummylist2(i,1),1,1)) 
			End Select 
		Else 
			Initialletter = "zzz" & Dummylist2(i,1) 
		End If 
		Initialletter = Initialletter & Mid(Dummylist2(i,1),2,len(Dummylist2(i,1)) 
		Dummylist2(i,0) = Initialletter 
	Next 
	i = UBound(Dummylist2()) 
	For s = 1 To i - 1 
		For t = 0 To i-s 
			If Dummylist2(t,0) > Dummylist2(t+1,0) Then 
				For k = 0 To dimension+1 
					DisplayDummy = Dummylist2(t,k) 
					Dummylist2(t,k) = Dummylist2(t+1,k) 
					Dummylist2(t+1,k) = DisplayDummy 
				Next k 
			End If 
		Next t 
	Next s 
	If dimension > 0 Then 
		Dim SetNr As Integer 
		For i = 0 To UBound(Dummylist2()) 
			SetNr = Dummylist2(i,2) 
			For s = 0 To dimension 
				Dummylist2(i,s) = SortList(SetNr,s) 
			Next 
		Next 
	End If 
	If dimension = 0 Then 
		For i = 0 To UBound(Dummylist2()) 
			Dummylist(i) = Dummylist2(i,1) 
		Next 
		BubbleSortList_2 = Dummylist() 
	Else 
		BubbleSortList_2 = Dummylist2() 
	End If 
End Function
Comment 1 Olaf Hautow 2015-03-07 05:38:30 UTC
Sorry!
The last rows be must:
        .
        .
        .
	If dimension = 0 Then 
		For i = 0 To UBound(Dummylist2()) 
			Dummylist(i) = Dummylist2(i,1) 
		Next 
		BubbleSortList_2 = Dummylist() 
	Else 
		ReDim Preserve DummyList2(UBound(SortList()),dimension)
		BubbleSortList_2 = DummyList2()
	End If 
End Function
Comment 2 Julien Nabet 2015-04-06 15:52:24 UTC
Olaf: what about contributing directly on LibreOffice? :-)
You may start here:
https://wiki.documentfoundation.org/Development
then propose a patch by following this link: https://wiki.documentfoundation.org/Development/gerrit
?
Comment 3 Pierre Lepage 2016-12-21 23:43:23 UTC
You wrote: "In Libre-Office Macros/Tools/Strings exists the macro "BubbleSortList".". Where did you find the BASIC code in LibreOffice?
Comment 4 Xisco Faulí 2017-01-12 12:09:22 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-07-27 12:06:33 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2017-08-30 19:31:55 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20170830