Maximum Function

282 views
Skip to first unread message

MEHMET HINC

unread,
Oct 13, 2015, 5:40:57 AM10/13/15
to mapi...@googlegroups.com
Dear All,

Is there any way to understand which column was used to determine maximum value ?

I mean if I use Maximum(RSRP01,Maximum(RSRP02,RSRP03)) then I have correct value however how can I figure it out this value is coming from which column ? So, basically I need to select best value in each line with column name :)

Inline image 1

BR,
Mehmet

Uffe Kousgaard

unread,
Oct 13, 2015, 5:50:51 AM10/13/15
to mapi...@googlegroups.com
Hi,

No, if you need to know that, you will have to do it in mapbasic and update one record at a time. Shouldn't be that difficult.

Regards
Uffe Kousgaard

MEHMET HINC wrote:
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MEHMET HINC

unread,
Oct 13, 2015, 5:57:07 AM10/13/15
to mapi...@googlegroups.com
Hi Uffe, All

Yes I actually do this I mean mapbasic. However I have million lines and it takes time like hell not possible to wait for mapbasic. I tried to create combinations and do SQL select , it works fast however in this case i don't have generic structure for every data i need to spend some time to create combinations such as RSRP01>RSRP02 or etc... too many combinations.

Anyway , many thanks for your reply.

Mehmet

Uffe Kousgaard

unread,
Oct 13, 2015, 6:01:39 AM10/13/15
to mapi...@googlegroups.com
Hi,

Do you have "set table xx fastedit on" in your mapbasic code?
Then commits are instant and it goes much faster.
If still too slow and too many records, export to CSV and do the processing in a faster environment.

Regards
Uffe

Robert Crossley

unread,
Oct 13, 2015, 6:05:30 AM10/13/15
to mapi...@googlegroups.com

If you do it in a mapbasic, updating a table is much quicker if you use a function something like:

 

Sub Main

 

set table Tablename fastedit on

Update Table Tablename Set resultfieldMaxValue = fGetMaximumValue(RSRP01, RSRP02, RSRP03)

Update Table Tablename Set resultfieldMaxField= fGetMaximumField (“RSRP01”, RSRP01, “RSRP02”, RSRP02, “RSRP03”, RSRP03)

 

End Sub

 

Function fGetMaximumValue(ByVal Field1 As Float, ByVal Field2 As Float, ByVal Field2 As Float) As Float

fGetMaximumValue = Maximum(Field1,Maximum(Field2,Field3))

End Function

 

Function fGetMaximumField(ByVal sField1Name As String, ByVal Field1 As Float, ByVal sField2Name As String, ByVal Field2 As Float, ByVal sField3Name As String, ByVal Field2 As Float) As String

If Field1 >= Field2 And Field1 >= Field3 Then

                fGetMaximumField = sField1Name

ElseIf Field2 >= Field1 And Field2>= Field3 Then

                fGetMaximumField = sField1Name

ElseIf Field3 >= Field1 And Field3>= Field2 Then

                fGetMaximumField = sField3Name

End If

 

End Function

MEHMET HINC

unread,
Oct 13, 2015, 6:50:51 AM10/13/15
to mapi...@googlegroups.com
Many thanks for your fast reply. Yes I was using fastedit option as well. However this is related to machine power as well I know . So I don't bother you again.

Many thanks for the sample code . I was using pretty similar :)

Again thank you all for your effort.

BR,
Mehmet

Glen O

unread,
Oct 13, 2015, 11:04:54 AM10/13/15
to MapInfo-L
this look  like an LTE log file. let me save you lots of time DON"T use mapinfo use VB.net and ONLY create maps with mapinfo

it is way to S L O W to be useful

and RSRP Antenna 0 RSRP Antenna 1 on the phone for NBR only 1 value 

MEHMET HINC

unread,
Oct 13, 2015, 11:10:15 AM10/13/15
to mapi...@googlegroups.com
yes , it is :) this is output from Romes . There is a chance to export log in MIF format to use in MapInfo however sorting algorithm inside does not work properly. Therefore I have to do rest of the process manually ...

I will handle in .Net for sure :)

Thanks

BR,
Mehmet

--

Sheila Quan

unread,
Oct 13, 2015, 11:30:44 AM10/13/15
to mapinfo-l
Hi Mehmet
 
Although I love MIPro - wouldn't this task be easier done in MS Excel using VLookup or HLookup?
 
Kind regards
 
Sheila

Kind regards
 
Sheila

Peter Horsbøll Møller

unread,
Oct 14, 2015, 3:24:27 AM10/14/15
to mapi...@googlegroups.com

Did you try creating a custom function and using this to update your column?

 

Function GetColumnWithMaximumValue(    ByVal sColName1 As String

                                     , ByVal sColName2 As String

                                     , ByVal sColName3 As String

                                     , ByVal fColValue1 As Float

                                     , ByVal fColValue2 As Float

                                     , ByVal fColValue3 As Float

                                     ) As String

 

If fColValue1 > fColValue2 Then

   If fColValue1 > fColValue3 Then

      GetColumnWithMaximumValue = sColName1

   ElseIf fColValue1 < fColValue3 Then

      GetColumnWithMaximumValue = sColName3

   End If               

ElseIf fColValue1 < fColValue2 Then

   If fColValue2 > fColValue3 Then

      GetColumnWithMaximumValue = sColName2

   ElseIf fColValue2 < fColValue3 Then

      GetColumnWithMaximumValue = sColName3

   End If               

End If

 

End Function

 

And the update statement would look like this:

 

Set Table MYTABLE FastEdit On Undo Off

Update MYTABLE

   Set MAXCOLUMNNAME = GetColumnWithMaximumValue(“RSRP01”, “RSRP02”, “RSRP03”, RSRP01, RSRP02, RSRP03)

     , MACVALUE = Maximum(RSRP01,Maximum(RSRP02,RSRP03))

Commit Table MYTABLE

 

Please note that I don’t really deal with the situation where values are alike.

It will also speed up things if you remove any index on the columns you are updating

 

I hope this helps

 

Peter Horsbøll Møller

Pitney Bowes

 

From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On Behalf Of MEHMET HINC
Sent: 13. oktober 2015 11:57
To: mapi...@googlegroups.com
Subject: Re: [MI-L] Maximum Function

 

Hi Uffe, All

MEHMET HINC

unread,
Oct 14, 2015, 3:45:26 AM10/14/15
to mapi...@googlegroups.com
Hi All, Uffe,

Many thanks once again for your precious support. Yes I was using mapbasic code to solve this problem but Uffe you gave me another idea , i will take it to the another level , because I need overall sorting algorithm :)

Once again many thanks.

Btw, I have discussed this with Rhode&Schwarz company and they will fix sorting problem/bug in the tool . This is also good for me .

BR,
Mehmet
Reply all
Reply to author
Forward
0 new messages