SV: MI-L Wait Function

2004-05-17 Thread Thomsen, Bo Victor
Hi Robert -

Regarding the constants:

Yes - you can add theese particular constants together instead for "or"-ing
them. Every constant is a binary "switch"
&H1 ==> sets bit 0 high, &H2 ==> sets bit 1 high ... , &H1 + &H2 = &H3 =
binary 0011 (bit 0 and 1 is set high). 

None of the constants are setting more than one particular bit, so adding
and "or"-ing the constants are equivalent in this case.

Regarding the "pHandles" argument in the MsgWaitForMultipleObjects function:

It's a array of handle identifiers (A handle is an (32 bit unsigned long)
identifier for a window in MS-Windows)  
You can't simply transfer af constant 0. So declare a dummy variable 

Dim dummy as integer
dummy = 0

  ... MsgWaitForMultipleObjects(0, dummy, 0, timeRemaining, QS_ALLINPUT) > 0


A search on Google reveals that the MsgWaitForMultipleObjects function
monitors one or more MS-Windows "windows" for specified events.

What _I_ can't understand is: what's happening when you specify _no_ windows
identifiers ?? . But all the vb examples found using Google are setting
phandles = 0 (meaning no handles in the phandles array) .. strange ..


Anyway, Here is a functioning example of using the MsgWaitForMultipleObjects
function from MapBasic...

(push any key inside 5 seconds after starting the MapBasic program..)

++

DEFINE QS_KEY &H1
DEFINE QS_MOUSEMOVE &H2
DEFINE QS_MOUSEBUTTON &H4
DEFINE QS_POSTMESSAGE &H8
DEFINE QS_TIMER &H10
DEFINE QS_PAINT &H20
DEFINE QS_SENDMESSAGE &H40
DEFINE QS_HOTKEY &H80
DEFINE QS_MOUSE (QS_MOUSEMOVE + QS_MOUSEBUTTON)
DEFINE QS_INPUT (QS_MOUSE + QS_KEY)
DEFINE QS_ALLEVENTS (QS_INPUT + QS_POSTMESSAGE + QS_TIMER + QS_PAINT +
QS_HOTKEY)
DEFINE QS_ALLINPUT (QS_SENDMESSAGE + QS_PAINT + QS_TIMER + QS_POSTMESSAGE +
QS_MOUSEBUTTON + QS_MOUSEMOVE + QS_HOTKEY + QS_KEY)


declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal nCount As
Integer, pHandles As Integer, ByVal fWaitAll As Integer, ByVal
dwMilliseconds As Integer, ByVal dwWakeMask As Integer) As Integer
declare Sub Main
declare Sub MsgWait(ByVal ms As Integer)

Sub MsgWait(ByVal ms As Integer)

  Dim dummy as integer, i As Integer

  Dummy = 0

  i = MsgWaitForMultipleObjects (0, dummy, 0, ms, QS_KEY)

  note ("return value = " + i)

END SUB

sub main 

  call msgwait (5000) '5 sec

end sub



regards 

Bo Thomsen
GeoConsult I/S
 


-Oprindelig meddelelse-
Fra: Robert Crossley [mailto:[EMAIL PROTECTED]
Sendt: 17. maj 2004 02:29
Til: MapInfo List
Emne: MI-L Wait Function



Hi all,

Still having some trouble with a function on XP, and an associate 
suggested that the problem may be helped by pausing the program to allow 
?buffers to be flushed? before going onto the next operation (the exact 
description of the potential problem was on the assembly code side of 
where I am comfortable working).

Anyway, he suggested the sleep function does not help as there is a 
problem with sleep on XP, and I don't want to pause the execution of 
MapInfo, but rather just stop moving on until MapInfo had caught up.  The 
following VB code was given as an option, and while most of it is fairly 
easy to convert (eg. Private Const -> DEFINE), I am having trouble working 
out how to call the MsgWaitForMultipleObjects function.  It is failing in 
MapBasic as the define functions don't work with constants which use the 
Or in them (understandable as it just substitutes the text).  I am getting 
a compile error when calling

 If MsgWaitForMultipleObjects(0, 0, 0, timeRemaining, QS_ALLINPUT) > 0 
Then
 End If

Has anyone implemented this function in MapBasic? or is there an 
alternative?  I want to pause MapInfo from processing the next operation 
while allowing it to finish what it was doing.

r

Original VB code
Private Const QS_KEY = &H1
Private Const QS_MOUSEMOVE = &H2
Private Const QS_MOUSEBUTTON = &H4
Private Const QS_POSTMESSAGE = &H8
Private Const QS_TIMER = &H10
Private Const QS_PAINT = &H20
Private Const QS_SENDMESSAGE = &H40
Private Const QS_HOTKEY = &H80
Private Const QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)
Private Const QS_INPUT = (QS_MOUSE Or QS_KEY)
Private Const QS_ALLEVENTS = (QS_INPUT Or QS_POSTMESSAGE Or QS_TIMER Or 
QS_PAINT Or QS_HOTKEY)
Private Const QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or QS_TIMER Or 
QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or QS_HOTKEY Or QS_KEY)

Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal 
nCount As Long, pHandles As Long, ByVal fWaitAll As Long, ByVal 
dwMilliseconds As Long, ByVal dwWakeMask As Long) As Long

' *
' * MsgWait
' *
' * Sleeps for a specified time but allows
' * events to process immediately
' *
' * Input: ms - milliseconds to wait
' * Output: none
' *
Public Sub MsgWait(ByVal ms As Long)

   Dim start As Long, timeRemaining As Long, timeNow As Long

   start = G

MI-L summ: Wait Function

2004-05-17 Thread Robert Crossley
Thanks all for the help and the education on hex ORing.  I have now got 
the wait function working fine.

In the code you just have to put Call MsgWait(200) and it will wait 200 
millisecond, while I believe processing any current processes going, and 
it works on XP (which  sleep doesn't- at least that is what I am led to 
believe).

Not sure if it helped the problem in the end, but after more work, I am 
more convinced the issues with XP are related to doing a rapid number of 
selections and fetching on small files.

If any one is interested, I wrote a function to return the cutter object 
given a line and a polygon.  The current function that MapBasic provides 
puts the line into the same table and then it puts the cutter in there as 
well, which means that you then have to clean it out later.  Having a 
function that returns an cutter object variable means you can do the split 
processing in object variables, thereby reducing the amount of 
selections.  This seems to have made a difference to the number of 
crashes, but am not confident yet that the problem is resolved.  It is 
still in testing, but if anyone is interested, I would be happy to share.

Anyway the code for the wait function (may be of use for printing 
problems?) is:

'DEFINES for the Wait function
DEFINE QS_KEY 1
DEFINE QS_MOUSEMOVE 2
DEFINE QS_MOUSEBUTTON 4
DEFINE QS_POSTMESSAGE 8
DEFINE  QS_TIMER 16
DEFINE  QS_PAINT 32
DEFINE  QS_SENDMESSAGE 64
DEFINE  QS_HOTKEY 128
DEFINE  QS_MOUSE 6
DEFINE  QS_INPUT 7
DEFINE  QS_ALLEVENTS 191
DEFINE  QS_ALLINPUT 255
Declare Function GetTickCount Lib "kernel32" () As Integer
Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal nCount As 
Integer, pHandles As Integer, ByVal fWaitAll As Integer, ByVal 
dwMilliseconds As Integer, ByVal dwWakeMask As Integer) As Integer

Declare Sub MsgWait(ByVal ms As Integer)
Sub MsgWait(ByVal ms As Integer)
'---
'Written By:RC
'---
Dim start As Integer
Dim timeRemaining As Integer
Dim timeNow As Integer
Dim Handles As Integer
'Set up general error handler
ONERROR GOTO ErrorHandler
Print "Waiting " + ms + " milliseconds."
  start = GetTickCount()
  timeRemaining = ms
  Do
If MsgWaitForMultipleObjects(0, Handles, 0, timeRemaining, 
QS_ALLINPUT) > 0 Then
End If
timeNow = GetTickCount()
If timeNow - start >= timeRemaining Then
  Exit Sub
ElseIf timeNow < start Then
  ' Handle GetTickCount 49.7 day wrap around
  start = timeNow
End If
timeRemaining = timeRemaining - (timeNow - start)
start = timeNow
'DoEvents
  Loop
EXIT SUB
ErrorHandler:
	CALL ErrorMessage("MsgWait")
END SUB 'ProForma

r
--
Robert Crossley
Agtrix P/L
9 Short St
PO Box 63
New Brighton 2483
Far Southern Queensland
AUSTRALIA
153.549004 E 28.517344 S
P: 02 6680 1309
F: New Connection
M: 0419 718 642
E: [EMAIL PROTECTED]
W: www.agtrix.com
W: www.wotzhere.com
-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11779


MI-L ProViewer and Hyperlink

2004-05-17 Thread Stefan Majtan
I have a table with hyperlinks defined. The hyperlinks are paths to 
different MI workspaces. In MapInfo, if I click on an object with the 
hyperlink tool, the workspace opens in the running instance of MapInfo, 
but in ProViewer it starts MapInfo first and the workspace is opened 
there. I associated files with WOR extension to ProViewer, but workspaces 
are opened in a new instance each time it is lounched. How to force 
ProViewer to open hyperlinked workspace in the running instance of it?

Any help is much appreciated!
Stefan Majtan
--
**
TERRIS
GIS Applications Development
Grid Analyser - raster GIS for native MapInfo grid
Pod záhradkami 24
909 01 Skalica
SLOVAKIA
http://www.terris.sk
**
-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11780


MI-L Previous Selection

2004-05-17 Thread Hankins, Mike
Good morning, 
I want to know if anyone has ever created a tool to select the previous
selection.  I work with lots of objects and some are very small, if I select
the wrong node, I would like to hit a button and get back the original
selectionl.  A undue button for selection.   I have been on the list for
several years and do not remember anyone else asking for this.  
TIA,
Mike Hankins
Actuarial Services Analyst
COUNTRY Insurance and Financial Services



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11781

Re: MI-L Previous Selection

2004-05-17 Thread Soporte
Mike,

You can use the SelChangedHandler handler to keep the last selectcion.

May be samething like this:

Sub SelChangedHandler

Select * From Seletion Into WK_Previous_Selection NoSelect

End Sub

Remember each time you select de-select any object this Sub is called. So
your program could be slow.

I hope this helps you.

Alejandro




- Original Message - 
From: "Hankins, Mike" <[EMAIL PROTECTED]>
To: "MapInfo-L (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 10:11 AM
Subject: MI-L Previous Selection


> Good morning,
> I want to know if anyone has ever created a tool to select the previous
> selection.  I work with lots of objects and some are very small, if I
select
> the wrong node, I would like to hit a button and get back the original
> selectionl.  A undue button for selection.   I have been on the list for
> several years and do not remember anyone else asking for this.
> TIA,
> Mike Hankins
> Actuarial Services Analyst
> COUNTRY Insurance and Financial Services
>
>
>
>






> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11781


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11782



Re: MI-L Previous Selection

2004-05-17 Thread Lars V. Nielsen (GisPro)
Hi Mike,

Unless you've deleted it manually, all queries are stored temporarily as tables with 
names like QUERY001.

All you have to do to reestablish any such past query is to select all rows in the 
appropriate QUERY table.

Best regards/Med venlig hilsen
Lars V. Nielsen
GisPro, Denmark
http://www.gispro.dk/
- Original Message - 
From: "Hankins, Mike" <[EMAIL PROTECTED]>
To: "MapInfo-L (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 3:11 PM
Subject: MI-L Previous Selection


> Good morning, 
> I want to know if anyone has ever created a tool to select the previous
> selection.  I work with lots of objects and some are very small, if I select
> the wrong node, I would like to hit a button and get back the original
> selectionl.  A undue button for selection.   I have been on the list for
> several years and do not remember anyone else asking for this.  
> TIA,
> Mike Hankins
> Actuarial Services Analyst
> COUNTRY Insurance and Financial Services
> 
> 
> 
> 





> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11781

-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11783



SUM: MI-L Testing to ensure a string is numeric

2004-05-17 Thread Tim.Nuteson
Thanks to all who responded to my question:  How can I ensure that a
value entered into an EditText control of a MB dialog is numeric?  The
simplest solution was offered by Michael Taylor, Martin Highham, and
Robert Crossley:

If str$(val(teststring)) = teststring then
  'numeric
Else
  'not
End If

Thanks again,

Tim Nuteson
Target


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11784



RE: MI-L Wait Function

2004-05-17 Thread Spencer Simpson
I know you've had someone work out your Windows API function problem,
but I wanted to make sure that you knew that, depending upon what you
were doing, you might have been able to accomplish the same thing without
it. 

Since you didn't state what you wanted MapInfo to catch up doing, I
figured I should put this out there and let people react to it.

MapBasic contains an "Update Window" command which makes it process all 
of the Windows messages sent to a particular window before returning 
control to the program.  The syntax is

Update Window 

where window_id is the integer value of an open Map, Browser, Graph, 
or Layout window.  It can also be a variable containing such a value. 

Update Window is useful in handlers where you need to make the user see
something in a window before the program goes ahead an does something else.

Update Window does have its limitations, but you don't have to guess at a
magical constant time to wait, either.

Hope this helps
Spencer


-Original Message-
From: Robert Crossley [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 16, 2004 8:29 PM
To: MapInfo List
Subject: MI-L Wait Function


Hi all,

Still having some trouble with a function on XP, and an associate 
suggested that the problem may be helped by pausing the program to allow 
?buffers to be flushed? before going onto the next operation (the exact 
description of the potential problem was on the assembly code side of 
where I am comfortable working).

Anyway, he suggested the sleep function does not help as there is a 
problem with sleep on XP, and I don't want to pause the execution of 
MapInfo, but rather just stop moving on until MapInfo had caught up.  The 
following VB code was given as an option, and while most of it is fairly 
easy to convert (eg. Private Const -> DEFINE), I am having trouble working 
out how to call the MsgWaitForMultipleObjects function.  It is failing in 
MapBasic as the define functions don't work with constants which use the 
Or in them (understandable as it just substitutes the text).  I am getting 
a compile error when calling

 If MsgWaitForMultipleObjects(0, 0, 0, timeRemaining, QS_ALLINPUT) > 0 
Then
 End If

Has anyone implemented this function in MapBasic? or is there an 
alternative?  I want to pause MapInfo from processing the next operation 
while allowing it to finish what it was doing.

r

Original VB code
Private Const QS_KEY = &H1
Private Const QS_MOUSEMOVE = &H2
Private Const QS_MOUSEBUTTON = &H4
Private Const QS_POSTMESSAGE = &H8
Private Const QS_TIMER = &H10
Private Const QS_PAINT = &H20
Private Const QS_SENDMESSAGE = &H40
Private Const QS_HOTKEY = &H80
Private Const QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)
Private Const QS_INPUT = (QS_MOUSE Or QS_KEY)
Private Const QS_ALLEVENTS = (QS_INPUT Or QS_POSTMESSAGE Or QS_TIMER Or 
QS_PAINT Or QS_HOTKEY)
Private Const QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or QS_TIMER Or 
QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or QS_HOTKEY Or QS_KEY)

Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal 
nCount As Long, pHandles As Long, ByVal fWaitAll As Long, ByVal 
dwMilliseconds As Long, ByVal dwWakeMask As Long) As Long

' *
' * MsgWait
' *
' * Sleeps for a specified time but allows
' * events to process immediately
' *
' * Input: ms - milliseconds to wait
' * Output: none
' *
Public Sub MsgWait(ByVal ms As Long)

   Dim start As Long, timeRemaining As Long, timeNow As Long

   start = GetTickCount()
   timeRemaining = ms
   Do
 ' Sleep until timeout or event occurs
 MsgWaitForMultipleObjects 0, 0, 0, timeRemaining, QS_ALLINPUT
 timeNow = GetTickCount()
 If timeNow - start >= timeRemaining Then
   Exit Sub
 ElseIf timeNow < start Then
   ' Handle GetTickCount 49.7 day wrap around
   start = timeNow
 End If
 timeRemaining = timeRemaining - (timeNow - start)
 start = timeNow
 DoEvents
   Loop
End Sub


Converted to Mapinfo
'DEFINES for the Wait function
DEFINE QS_KEY = &H1
DEFINE QS_MOUSEMOVE = &H2
DEFINE QS_MOUSEBUTTON = &H4
DEFINE QS_POSTMESSAGE = &H8
DEFINE  QS_TIMER = &H10
DEFINE  QS_PAINT = &H20
DEFINE  QS_SENDMESSAGE = &H40
DEFINE  QS_HOTKEY = &H80
DEFINE  QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)
DEFINE  QS_INPUT = (QS_MOUSE Or QS_KEY)
DEFINE  QS_ALLEVENTS = (QS_INPUT Or QS_POSTMESSAGE Or QS_TIMER Or QS_PAINT 
Or QS_HOTKEY)
DEFINE  QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or QS_TIMER Or 
QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or QS_HOTKEY Or QS_KEY)


Sub MsgWait(ByVal ms As Integer)
'---
'Written By:RC
'---

Dim start As Integer
Dim timeRemaining As Integer
Dim timeNow As Integer

'Set up general error handler
ONERROR GOTO ErrorHandler

Print "Waiting " + ms + " milliseconds."

   start = GetTickCount()
   timeRema

MI-L Site Location Tool - Waste Management

2004-05-17 Thread Eagle, David A
Listers,

Can anyone recommend or point me in the direction of an "out-of-the-box"
site location tool? A MapInfo bolt on or alternative product...

The specific task is for waste management and relates to optimising
locations for waste management facilities based on waste source, waste type,
road network, population etc, etc. The ability to highlight 'no-go' areas is
also required.

This is basically like supermarket store location analysis but with a twist.
Who are the leading vendors...just need a pointer to start my
investigations. Apologies for the slight off-topic post.

Any help gratefully received.

Cheers, Dave

David A. Eagle
GIS Consultant

ATKINS ENVIRONMENT
Cornerstone House
Stafford Park 13, Telford
Shropshire, TF3 3AZ
United Kingdom

Tel: +44 (0)1952 213268
Fax: +44 (0)1952 200981
Email: [EMAIL PROTECTED]  
Web: www.atkinsglobal.com  



This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11786



MI-L Summation Last Selection Recovery

2004-05-17 Thread Hankins, Mike
I want to thank all who responded.   Tony from the UK is the man.  He sent
me an MBX that works wonderfully.  I suggested he post it to directions mag.
If anyone else wants this solution, let me know.

Mike Hankins
Actuarial Services Analyst
COUNTRY Insurance and Financial Services



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11787

Re: SUM: MI-L Testing to ensure a string is numeric

2004-05-17 Thread B. Thoen
Would that algorithm return the correct result if you fed it a numeric 
string like '0023456', or are numbers with leading zeros not going to be 
encountered?


On Mon, 17 May 2004, Tim.Nuteson wrote:

> Thanks to all who responded to my question:  How can I ensure that a
> value entered into an EditText control of a MB dialog is numeric?  The
> simplest solution was offered by Michael Taylor, Martin Highham, and
> Robert Crossley:
> 
>   If str$(val(teststring)) = teststring then
> 'numeric
>   Else
> 'not
>   End If
> 
> Thanks again,
> 
> Tim Nuteson
> Target
> 
> 
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11784
> 


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11788



RE: MI-L Testing to ensure a string is numeric

2004-05-17 Thread Spencer Simpson
No, it will notThere are a couple of ways to implement them, some of which
are more efficient than others.   

The str$(val()) method is the fastest method, but it's not the most robust.
For one thing, it works only for integers.  However, it's great for quick
applications that require only integers.

For robust, idiot-proof applications, you need more sophisticated validation
routines.

It is possible, of course, to write a routine that scans the string
for the correct format, but this can be very slow, given that you
have to make calls to mid$() for every character in the string.  If
you've been programming for any length of time, you've probably written
one that you can adapt to MapBasic.  Or you can write one in a faster
language, put it in a DLL, and link to it from MapBasic (scanf is NOT 
recommended).

Another method is to try assigning the string to a MapBasic window variable,
and catching any errors. This method is optimal for validating strings that
can take non-integer values.

run command "Dim v_dbl as float"
...
function good_float (ByVal s as string, f as float) as logical
On Error Goto notvalid
run command "v_dbl="+sval
OnError goto 0
f=val(Sval)
good_float = true
exit function
notvalid: resume failure
failure:  good_float = false
end function


Hope this helps
Spencer



-Original Message-
From: B. Thoen [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 11:05 AM
To: Tim.Nuteson
Cc: [EMAIL PROTECTED]
Subject: Re: SUM: MI-L Testing to ensure a string is numeric

Would that algorithm return the correct result if you fed it a numeric 
string like '0023456', or are numbers with leading zeros not going to be 
encountered?


On Mon, 17 May 2004, Tim.Nuteson wrote:

> Thanks to all who responded to my question:  How can I ensure that a
> value entered into an EditText control of a MB dialog is numeric?  The
> simplest solution was offered by Michael Taylor, Martin Highham, and
> Robert Crossley:
> 
>   If str$(val(teststring)) = teststring then
> 'numeric
>   Else
> 'not
>   End If
> 
> Thanks again,
> 
> Tim Nuteson
> Target
> 
> 
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11784
> 


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11788



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11789



Re: MI-L points with same lat/lon

2004-05-17 Thread Robert DeRubeis
I've done this, and found that I have 100's of duplications of 2 or more,
but I need all of the records that are duplicates.When a count query
is done it does not select all records with matching lat/lon's.  It
returns, for example, 
Count   Lat Lon
6   49.715709   -123.156264
5   49.709248   -124.916418
4   43.745795   -79.526276
etc, etc..

There are 15 records above with the same lat/lon.  I need to be able to
select all 15 records?
-Bob

"Kir Luong" <[EMAIL PROTECTED]> writes:
>If the lat or long is the same then a count and group by function on
>those variables should give you the records that are identical (group by
>clause) and how many duplication (count function):
>I'm not sure the mapinfo SqL...but something like:
>
>Select count(*),lat
>from table1
>group by lat
>having  count(*) > 1;
>execute;  ===> returns a table of all lats that are duplicated and the
>number of duplication
>
>likewise for the longs. Hope this helps.
>
>kir.
>
>-Original Message-
>From: Robert DeRubeis [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 14, 2004 3:03 PM
>To: [EMAIL PROTECTED]
>Subject: MI-L points with same lat/lon
>
>
>List-
>Is there a way to select all records from one table where the values in 2
>different columns are identical? I wanted to select all records where the
>lat of 1st record = lat of 2nd record AND lon of 1st record = lon of 2nd
>record.  I'm trying to identify where and how many points are right on top
>of each other and if they need to be dispersed or better geocoding.
>
>The table has about 30,000 points and I'm using MIPro 6.5.
>Thanks,
>-Bob
>
>
>-
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>Message number: 11767
>
>
>This communication is intended for the use of the recipient to which it
>is addressed, and may contain confidential, personal and or privileged
>information. Please contact us immediately if you are not the intended
>recipient of this communication, and do not copy, distribute, or take
>action relying on it. Any communication received in error, or subsequent
>reply, should be deleted or destroyed


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11790



RE: MI-L points with same lat/lon

2004-05-17 Thread Lawley, Russell S
Robert, i have this problem with borehole data

the way i solve it is to make sure i createpoints on teh lat lon..

i then make a query of the whole table  (select * from MyBore into myquery))

I then update mybore with a count of objects from MyQuery (set teh joins so that it is 
where objects in MYBORE intersect objects in MYQuery)

this adds a temporary column to Mybore (COUNT_OF_MYQUERY)

I then select  * from Mybore where the COUNT_OF_MYQUERY is >1  (ie more than one bore 
at that loc..)


hth

r




-Original Message-
From: Robert DeRubeis [mailto:[EMAIL PROTECTED]
Sent: 17 May 2004 17:02
To: [EMAIL PROTECTED]
Cc: Kir Luong; Peter Horsb¿ll M¿ller
Subject: Re: MI-L points with same lat/lon


I've done this, and found that I have 100's of duplications of 2 or more,
but I need all of the records that are duplicates.When a count query
is done it does not select all records with matching lat/lon's.  It
returns, for example, 
Count   Lat Lon
6   49.715709   -123.156264
5   49.709248   -124.916418
4   43.745795   -79.526276
etc, etc..

There are 15 records above with the same lat/lon.  I need to be able to
select all 15 records?
-Bob

"Kir Luong" <[EMAIL PROTECTED]> writes:
>If the lat or long is the same then a count and group by function on
>those variables should give you the records that are identical (group by
>clause) and how many duplication (count function):
>I'm not sure the mapinfo SqL...but something like:
>
>Select count(*),lat
>from table1
>group by lat
>having  count(*) > 1;
>execute;  ===> returns a table of all lats that are duplicated and the
>number of duplication
>
>likewise for the longs. Hope this helps.
>
>kir.
>
>-Original Message-
>From: Robert DeRubeis [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 14, 2004 3:03 PM
>To: [EMAIL PROTECTED]
>Subject: MI-L points with same lat/lon
>
>
>List-
>Is there a way to select all records from one table where the values in 2
>different columns are identical? I wanted to select all records where the
>lat of 1st record = lat of 2nd record AND lon of 1st record = lon of 2nd
>record.  I'm trying to identify where and how many points are right on top
>of each other and if they need to be dispersed or better geocoding.
>
>The table has about 30,000 points and I'm using MIPro 6.5.
>Thanks,
>-Bob
>
>
>-
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>Message number: 11767
>
>
>This communication is intended for the use of the recipient to which it
>is addressed, and may contain confidential, personal and or privileged
>information. Please contact us immediately if you are not the intended
>recipient of this communication, and do not copy, distribute, or take
>action relying on it. Any communication received in error, or subsequent
>reply, should be deleted or destroyed


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11790



*
This  e-mail  message,  and  any  files  transmitted  with  it, are
confidential  and intended  solely for the  use of the  addressee. If
this message was not addressed to  you, you have received it in error
and any  copying,  distribution  or  other use  of any part  of it is
strictly prohibited. Any views or opinions presented are solely those
of the sender and do not necessarily represent  those of the British
Geological  Survey. The  security of e-mail  communication  cannot be
guaranteed and the BGS accepts no liability  for claims arising as a
result of the use of this medium to  transmit messages from or to the
BGS. .http://www.bgs.ac.uk
*


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11791



RE: MI-L points with same lat/lon

2004-05-17 Thread Spencer Simpson
Assuming you've done the following (which it sounds like you've done):

1. Update the lon and lat columns with centroidX and centroidY
2. Make the group-by query (group by lat and lon.
3. Make the query where count>1

You should then:

3. Save the result of query 2 to its own table (we'll call it DUPLOCS.TAB). 
4. Close the query tables generated in steps 1 and 2, then open the table
you saved in step 3 (DUPLOCS).
5. If the original table has 1 records or more, index its lat column,
and the lat column of DUPLOCS.
6. Perform a SQL Select:

select * from ORIGTAB, DUPLOCS where (origtab.lon=duplocs.lon) and
(origtab.lat=duplocs.lat)


Viola'!

Hope this helps
Spencer


-Original Message-
From: Robert DeRubeis [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 12:02 PM
To: [EMAIL PROTECTED]
Cc: Kir Luong; Peter Horsb¿ll M¿ller
Subject: Re: MI-L points with same lat/lon

I've done this, and found that I have 100's of duplications of 2 or more,
but I need all of the records that are duplicates.When a count query
is done it does not select all records with matching lat/lon's.  It
returns, for example, 
Count   Lat Lon
6   49.715709   -123.156264
5   49.709248   -124.916418
4   43.745795   -79.526276
etc, etc..

There are 15 records above with the same lat/lon.  I need to be able to
select all 15 records?
-Bob

"Kir Luong" <[EMAIL PROTECTED]> writes:
>If the lat or long is the same then a count and group by function on
>those variables should give you the records that are identical (group by
>clause) and how many duplication (count function):
>I'm not sure the mapinfo SqL...but something like:
>
>Select count(*),lat
>from table1
>group by lat
>having  count(*) > 1;
>execute;  ===> returns a table of all lats that are duplicated and the
>number of duplication
>
>likewise for the longs. Hope this helps.
>
>kir.
>
>-Original Message-
>From: Robert DeRubeis [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 14, 2004 3:03 PM
>To: [EMAIL PROTECTED]
>Subject: MI-L points with same lat/lon
>
>
>List-
>Is there a way to select all records from one table where the values in 2
>different columns are identical? I wanted to select all records where the
>lat of 1st record = lat of 2nd record AND lon of 1st record = lon of 2nd
>record.  I'm trying to identify where and how many points are right on top
>of each other and if they need to be dispersed or better geocoding.
>
>The table has about 30,000 points and I'm using MIPro 6.5.
>Thanks,
>-Bob
>
>
>-
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>Message number: 11767
>
>
>This communication is intended for the use of the recipient to which it
>is addressed, and may contain confidential, personal and or privileged
>information. Please contact us immediately if you are not the intended
>recipient of this communication, and do not copy, distribute, or take
>action relying on it. Any communication received in error, or subsequent
>reply, should be deleted or destroyed


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11790



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11792



RE: MI-L Testing to ensure a string is numeric

2004-05-17 Thread Martin Higham
No - str$(val("1.2345")) returns "1.2345".

Where it may fall down, is in the use of thousands separators.  For this you
should use
str$(val(DeformatNumber$("10,001"))).

With this, it will be robust, but you may want to check for and strip
leading zeroes (as Bill highlights).

Best Regards,

Martin Higham
Avantra Geosystems

ph (61 3) 8504 0428   0425-730-428
fx (61 3) 9596 7997
www.avantra.com.au




> -Original Message-
> From: Spencer Simpson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 18 May 2004 01:55
> To: [EMAIL PROTECTED]
> Subject: RE: MI-L Testing to ensure a string is numeric
>
>
> No, it will notThere are a couple of ways to implement them, some of which
> are more efficient than others.
>
> The str$(val()) method is the fastest method, but it's not the
> most robust.
> For one thing, it works only for integers.  However, it's great for quick
> applications that require only integers.
>
> For robust, idiot-proof applications, you need more sophisticated
> validation
> routines.
>
> It is possible, of course, to write a routine that scans the string
> for the correct format, but this can be very slow, given that you
> have to make calls to mid$() for every character in the string.  If
> you've been programming for any length of time, you've probably written
> one that you can adapt to MapBasic.  Or you can write one in a faster
> language, put it in a DLL, and link to it from MapBasic (scanf is NOT
> recommended).
>
> Another method is to try assigning the string to a MapBasic
> window variable,
> and catching any errors. This method is optimal for validating
> strings that
> can take non-integer values.
>
> run command "Dim v_dbl as float"
> ...
> function good_float (ByVal s as string, f as float) as logical
> On Error Goto notvalid
> run command "v_dbl="+sval
> OnError goto 0
> f=val(Sval)
> good_float = true
> exit function
> notvalid: resume failure
> failure:  good_float = false
> end function
>
>
> Hope this helps
> Spencer
>
>
>
> -Original Message-
> From: B. Thoen [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 17, 2004 11:05 AM
> To: Tim.Nuteson
> Cc: [EMAIL PROTECTED]
> Subject: Re: SUM: MI-L Testing to ensure a string is numeric
>
> Would that algorithm return the correct result if you fed it a numeric
> string like '0023456', or are numbers with leading zeros not going to be
> encountered?
>
>
> On Mon, 17 May 2004, Tim.Nuteson wrote:
>
> > Thanks to all who responded to my question:  How can I ensure that a
> > value entered into an EditText control of a MB dialog is numeric?  The
> > simplest solution was offered by Michael Taylor, Martin Highham, and
> > Robert Crossley:
> >
> > If str$(val(teststring)) = teststring then
> >   'numeric
> > Else
> >   'not
> > End If
> >
> > Thanks again,
> >
> > Tim Nuteson
> > Target
> >
> >
> > -
> > List hosting provided by Directions Magazine | www.directionsmag.com |
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > Message number: 11784
> >
>
>
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11788
>
>
>
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11789
>


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11793



Re: MI-L points with same lat/lon

2004-05-17 Thread Robert DeRubeis
Saving the count query and the last step was what I was missing and it
worked fine.  I thought it wouldn't take so many steps and having to save
query results, etc., but better more steps with it being able to be done,
than it can't do it.
Thanks to all
-Bob


"Spencer Simpson" <[EMAIL PROTECTED]> writes:
>Assuming you've done the following (which it sounds like you've done):
>
>1. Update the lon and lat columns with centroidX and centroidY
>2. Make the group-by query (group by lat and lon.
>3. Make the query where count>1
>
>You should then:
>
>3. Save the result of query 2 to its own table (we'll call it
>DUPLOCS.TAB). 
>4. Close the query tables generated in steps 1 and 2, then open the table
>you saved in step 3 (DUPLOCS).
>5. If the original table has 1 records or more, index its lat column,
>and the lat column of DUPLOCS.
>6. Perform a SQL Select:
>
>select * from ORIGTAB, DUPLOCS where (origtab.lon=duplocs.lon) and
>(origtab.lat=duplocs.lat)
>
>
>Viola'!
>
>Hope this helps
>Spencer
>
>
>-Original Message-
>From: Robert DeRubeis [mailto:[EMAIL PROTECTED] 
>Sent: Monday, May 17, 2004 12:02 PM
>To: [EMAIL PROTECTED]
>Cc: Kir Luong; Peter Horsb¿ll M¿ller
>Subject: Re: MI-L points with same lat/lon
>
>I've done this, and found that I have 100's of duplications of 2 or more,
>but I need all of the records that are duplicates.When a count query
>is done it does not select all records with matching lat/lon's.  It
>returns, for example, 
>Count  Lat Lon
>6  49.715709   -123.156264
>5  49.709248   -124.916418
>4  43.745795   -79.526276
>etc, etc..
>
>There are 15 records above with the same lat/lon.  I need to be able to
>select all 15 records?
>-Bob
>
>"Kir Luong" <[EMAIL PROTECTED]> writes:
>>If the lat or long is the same then a count and group by function on
>>those variables should give you the records that are identical (group by
>>clause) and how many duplication (count function):
>>I'm not sure the mapinfo SqL...but something like:
>>
>>Select count(*),lat
>>from table1
>>group by lat
>>having  count(*) > 1;
>>execute;  ===> returns a table of all lats that are duplicated and the
>>number of duplication
>>
>>likewise for the longs. Hope this helps.
>>
>>kir.
>>
>>-Original Message-
>>From: Robert DeRubeis [mailto:[EMAIL PROTECTED]
>>Sent: Friday, May 14, 2004 3:03 PM
>>To: [EMAIL PROTECTED]
>>Subject: MI-L points with same lat/lon
>>
>>
>>List-
>>Is there a way to select all records from one table where the values in 2
>>different columns are identical? I wanted to select all records where the
>>lat of 1st record = lat of 2nd record AND lon of 1st record = lon of 2nd
>>record.  I'm trying to identify where and how many points are right on
>top
>>of each other and if they need to be dispersed or better geocoding.
>>
>>The table has about 30,000 points and I'm using MIPro 6.5.
>>Thanks,
>>-Bob
>>
>>
>>-
>>List hosting provided by Directions Magazine | www.directionsmag.com |
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>Message number: 11767
>>
>>
>>This communication is intended for the use of the recipient to which it
>>is addressed, and may contain confidential, personal and or privileged
>>information. Please contact us immediately if you are not the intended
>>recipient of this communication, and do not copy, distribute, or take
>>action relying on it. Any communication received in error, or subsequent
>>reply, should be deleted or destroyed
>
>
>-
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>Message number: 11790



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11794



RE: MI-L Testing to ensure a string is numeric

2004-05-17 Thread Spencer Simpson
I'm sorry, but Str$(val())is NOT reliable for testing floating-point values.

I've been burned by this many, many times, and only use str$(val()) to test
integers in very simple applications.


In addition to the issue of leading zeroes, there are also issues with:

1. Looking for a "-" sign at the beginning, for a negative number (-1.2
should be considered valid)

2. getting rid of trailing zeroes, but only if there's a decimal in the
number. (123.4500 must match 123.45, but 1234500 must match 12345)
DeformatNumber$() will change a comma used by Europeans into a decimal point
for Val() to use.

3. Trailing decimal point for integers. ("123." must match "123")

4. Settings which limit the number of digits after the decimal point.  
On my system, str$(val("12345.678")) returns "12345.68".   

This is probably the most fatal issue, as the application writer has no
control over it (it's controlled by the user's local settings).  'Set Format
Number "9,999.9"' does NOT override it.

There are so many special cases that it's better to discard the 
entire system and use one of the holistic approaches I described in 
my earlier posting.

Hope this helps
Spencer


-Original Message-
From: Martin Higham [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 12:12 PM
To: Spencer Simpson
Cc: MapInfo-L
Subject: RE: MI-L Testing to ensure a string is numeric

No - str$(val("1.2345")) returns "1.2345".

Where it may fall down, is in the use of thousands separators.  For this you
should use
str$(val(DeformatNumber$("10,001"))).

With this, it will be robust, but you may want to check for and strip
leading zeroes (as Bill highlights).

Best Regards,

Martin Higham
Avantra Geosystems

ph (61 3) 8504 0428   0425-730-428
fx (61 3) 9596 7997
www.avantra.com.au




> -Original Message-
> From: Spencer Simpson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 18 May 2004 01:55
> To: [EMAIL PROTECTED]
> Subject: RE: MI-L Testing to ensure a string is numeric
>
>
> No, it will notThere are a couple of ways to implement them, some of which
> are more efficient than others.
>
> The str$(val()) method is the fastest method, but it's not the
> most robust.
> For one thing, it works only for integers.  However, it's great for quick
> applications that require only integers.
>
> For robust, idiot-proof applications, you need more sophisticated
> validation
> routines.
>
> It is possible, of course, to write a routine that scans the string
> for the correct format, but this can be very slow, given that you
> have to make calls to mid$() for every character in the string.  If
> you've been programming for any length of time, you've probably written
> one that you can adapt to MapBasic.  Or you can write one in a faster
> language, put it in a DLL, and link to it from MapBasic (scanf is NOT
> recommended).
>
> Another method is to try assigning the string to a MapBasic
> window variable,
> and catching any errors. This method is optimal for validating
> strings that
> can take non-integer values.
>
> run command "Dim v_dbl as float"
> ...
> function good_float (ByVal s as string, f as float) as logical
> On Error Goto notvalid
> run command "v_dbl="+sval
> OnError goto 0
> f=val(Sval)
> good_float = true
> exit function
> notvalid: resume failure
> failure:  good_float = false
> end function
>
>
> Hope this helps
> Spencer
>
>
>
> -Original Message-
> From: B. Thoen [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 17, 2004 11:05 AM
> To: Tim.Nuteson
> Cc: [EMAIL PROTECTED]
> Subject: Re: SUM: MI-L Testing to ensure a string is numeric
>
> Would that algorithm return the correct result if you fed it a numeric
> string like '0023456', or are numbers with leading zeros not going to be
> encountered?
>
>
> On Mon, 17 May 2004, Tim.Nuteson wrote:
>
> > Thanks to all who responded to my question:  How can I ensure that a
> > value entered into an EditText control of a MB dialog is numeric?  The
> > simplest solution was offered by Michael Taylor, Martin Highham, and
> > Robert Crossley:
> >
> > If str$(val(teststring)) = teststring then
> >   'numeric
> > Else
> >   'not
> > End If
> >
> > Thanks again,
> >
> > Tim Nuteson
> > Target
> >
> >
> > -
> > List hosting provided by Directions Magazine | www.directionsmag.com |
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > Message number: 11784
> >
>
>
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11788
>
>
>
> -
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [E

Re: MI-L Testing to ensure a string is numeric (An unortodox way)

2004-05-17 Thread Soporte
Why don't you try something like this:

Declare Sub Main
Sub Main()
Dim a as string
OnError Goto LocalError
a = a / 1
Exit sub

LocalError:
If Err() = 306 Then
Note "a is not numeric"
End If
End Sub


- Original Message - 
From: "Spencer Simpson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "'Spencer Simpson'" <[EMAIL PROTECTED]>
Cc: "'MapInfo-L'" <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 1:47 PM
Subject: RE: MI-L Testing to ensure a string is numeric


I'm sorry, but Str$(val())is NOT reliable for testing floating-point values.

I've been burned by this many, many times, and only use str$(val()) to test
integers in very simple applications.


In addition to the issue of leading zeroes, there are also issues with:

1. Looking for a "-" sign at the beginning, for a negative number (-1.2
should be considered valid)

2. getting rid of trailing zeroes, but only if there's a decimal in the
number. (123.4500 must match 123.45, but 1234500 must match 12345)
DeformatNumber$() will change a comma used by Europeans into a decimal point
for Val() to use.

3. Trailing decimal point for integers. ("123." must match "123")

4. Settings which limit the number of digits after the decimal point.  
On my system, str$(val("12345.678")) returns "12345.68".   

This is probably the most fatal issue, as the application writer has no
control over it (it's controlled by the user's local settings).  'Set Format
Number "9,999.9"' does NOT override it.

There are so many special cases that it's better to discard the 
entire system and use one of the holistic approaches I described in 
my earlier posting.

Hope this helps
Spencer


-Original Message-
From: Martin Higham [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 12:12 PM
To: Spencer Simpson
Cc: MapInfo-L
Subject: RE: MI-L Testing to ensure a string is numeric

No - str$(val("1.2345")) returns "1.2345".

Where it may fall down, is in the use of thousands separators.  For this you
should use
str$(val(DeformatNumber$("10,001"))).

With this, it will be robust, but you may want to check for and strip
leading zeroes (as Bill highlights).

Best Regards,

Martin Higham
Avantra Geosystems

ph (61 3) 8504 0428   0425-730-428
fx (61 3) 9596 7997
www.avantra.com.au




> -Original Message-
> From: Spencer Simpson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 18 May 2004 01:55
> To: [EMAIL PROTECTED]
> Subject: RE: MI-L Testing to ensure a string is numeric
>
>
> No, it will notThere are a couple of ways to implement them, some of which
> are more efficient than others.
>
> The str$(val()) method is the fastest method, but it's not the
> most robust.
> For one thing, it works only for integers.  However, it's great for quick
> applications that require only integers.
>
> For robust, idiot-proof applications, you need more sophisticated
> validation
> routines.
>
> It is possible, of course, to write a routine that scans the string
> for the correct format, but this can be very slow, given that you
> have to make calls to mid$() for every character in the string.  If
> you've been programming for any length of time, you've probably written
> one that you can adapt to MapBasic.  Or you can write one in a faster
> language, put it in a DLL, and link to it from MapBasic (scanf is NOT
> recommended).
>
> Another method is to try assigning the string to a MapBasic
> window variable,
> and catching any errors. This method is optimal for validating
> strings that
> can take non-integer values.
>
> run command "Dim v_dbl as float"
> ...
> function good_float (ByVal s as string, f as float) as logical
> On Error Goto notvalid
> run command "v_dbl="+sval
> OnError goto 0
> f=val(Sval)
> good_float = true
> exit function
> notvalid: resume failure
> failure:  good_float = false
> end function
>
>
> Hope this helps
> Spencer
>
>
>
> -Original Message-
> From: B. Thoen [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 17, 2004 11:05 AM
> To: Tim.Nuteson
> Cc: [EMAIL PROTECTED]
> Subject: Re: SUM: MI-L Testing to ensure a string is numeric
>
> Would that algorithm return the correct result if you fed it a numeric
> string like '0023456', or are numbers with leading zeros not going to be
> encountered?
>
>
> On Mon, 17 May 2004, Tim.Nuteson wrote:
>
> > Thanks to all who responded to my question:  How can I ensure that a
> > value entered into an EditText control of a MB dialog is numeric?  The
> > simplest solution was offered by Michael Taylor, Martin Highham, and
> > Robert Crossley:
> >
> > If str$(val(teststring)) = teststring then
> >   'numeric
> > Else
> >   'not
> > End If
> >
> > Thanks again,
> >
> > Tim Nuteson
> > Target
> >
> >
> > -
> > List hosting provided by Directions Magazine | www.directionsmag.com |
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > Message number: 1

FW: MI-L Testing to ensure a string is numeric (An unortodox way)

2004-05-17 Thread Spencer Simpson


-Original Message-
From: Spencer Simpson [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 2:06 PM
To: 'Soporte'
Subject: RE: MI-L Testing to ensure a string is numeric (An unortodox way)

I don't know which version of MapBasic you're using. 

In the version I use (5.0) this produces an error
("Numeric values required") no matter what's in the string.

It's essentially a type mismatch error.

Spencer



-Original Message-
From: Soporte [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 2:02 PM
To: 'MapInfo-L'
Subject: Re: MI-L Testing to ensure a string is numeric (An unortodox way)

Why don't you try something like this:

Declare Sub Main
Sub Main()
Dim a as string
OnError Goto LocalError
a = a / 1
Exit sub

LocalError:
If Err() = 306 Then
Note "a is not numeric"
End If
End Sub


- Original Message - 
From: "Spencer Simpson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "'Spencer Simpson'" <[EMAIL PROTECTED]>
Cc: "'MapInfo-L'" <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 1:47 PM
Subject: RE: MI-L Testing to ensure a string is numeric


I'm sorry, but Str$(val())is NOT reliable for testing floating-point values.

I've been burned by this many, many times, and only use str$(val()) to test
integers in very simple applications.


In addition to the issue of leading zeroes, there are also issues with:

1. Looking for a "-" sign at the beginning, for a negative number (-1.2
should be considered valid)

2. getting rid of trailing zeroes, but only if there's a decimal in the
number. (123.4500 must match 123.45, but 1234500 must match 12345)
DeformatNumber$() will change a comma used by Europeans into a decimal point
for Val() to use.

3. Trailing decimal point for integers. ("123." must match "123")

4. Settings which limit the number of digits after the decimal point.  
On my system, str$(val("12345.678")) returns "12345.68".   

This is probably the most fatal issue, as the application writer has no
control over it (it's controlled by the user's local settings).  'Set Format
Number "9,999.9"' does NOT override it.

There are so many special cases that it's better to discard the 
entire system and use one of the holistic approaches I described in 
my earlier posting.

Hope this helps
Spencer


-Original Message-
From: Martin Higham [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 12:12 PM
To: Spencer Simpson
Cc: MapInfo-L
Subject: RE: MI-L Testing to ensure a string is numeric

No - str$(val("1.2345")) returns "1.2345".

Where it may fall down, is in the use of thousands separators.  For this you
should use
str$(val(DeformatNumber$("10,001"))).

With this, it will be robust, but you may want to check for and strip
leading zeroes (as Bill highlights).

Best Regards,

Martin Higham
Avantra Geosystems

ph (61 3) 8504 0428   0425-730-428
fx (61 3) 9596 7997
www.avantra.com.au




> -Original Message-
> From: Spencer Simpson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 18 May 2004 01:55
> To: [EMAIL PROTECTED]
> Subject: RE: MI-L Testing to ensure a string is numeric
>
>
> No, it will notThere are a couple of ways to implement them, some of which
> are more efficient than others.
>
> The str$(val()) method is the fastest method, but it's not the
> most robust.
> For one thing, it works only for integers.  However, it's great for quick
> applications that require only integers.
>
> For robust, idiot-proof applications, you need more sophisticated
> validation
> routines.
>
> It is possible, of course, to write a routine that scans the string
> for the correct format, but this can be very slow, given that you
> have to make calls to mid$() for every character in the string.  If
> you've been programming for any length of time, you've probably written
> one that you can adapt to MapBasic.  Or you can write one in a faster
> language, put it in a DLL, and link to it from MapBasic (scanf is NOT
> recommended).
>
> Another method is to try assigning the string to a MapBasic
> window variable,
> and catching any errors. This method is optimal for validating
> strings that
> can take non-integer values.
>
> run command "Dim v_dbl as float"
> ...
> function good_float (ByVal s as string, f as float) as logical
> On Error Goto notvalid
> run command "v_dbl="+sval
> OnError goto 0
> f=val(Sval)
> good_float = true
> exit function
> notvalid: resume failure
> failure:  good_float = false
> end function
>
>
> Hope this helps
> Spencer
>
>
>
> -Original Message-
> From: B. Thoen [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 17, 2004 11:05 AM
> To: Tim.Nuteson
> Cc: [EMAIL PROTECTED]
> Subject: Re: SUM: MI-L Testing to ensure a string is numeric
>
> Would that algorithm return the correct result if you fed it a numeric
> string like '0023456', or are numbers with leading zeros not going to be
> encountered?
>
>
> On Mon, 17 May 2004, Tim.Nuteson wrote:
>
> > Thanks to all who responded to my question:  How ca

MI-L Coordinate Conversion

2004-05-17 Thread Wangberg, Willie (USBORAX)
Does anyone know of a MapBasic program or any program for that matter that will allow 
me to convert a list of coordinates at once? I am going from lat/long to UTM. I have 
found several websites that allow for a single coordinate, but not one that I can get 
to work for a batch process. I have tried the Corpscon and Trailane Evaluation version 
and cant seem to get them to work. Are there any others?

Willie Wangberg
Information Tech

Rio Tinto Exploration
52 Glen Carran Circle
Sparks, NV 89431
 
P: (775) 358-9500
F: (775) 358-9529
email: [EMAIL PROTECTED]


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11798



MI-L TFW - TAB

2004-05-17 Thread Ian Tidy
Hello,

Does anyone know of or have a tool for converting TFW files to TAB files (or
create TAB files from TFW)?

Cheers Ian
-- 
Ian Tidy
GIS Administrator
Works Asset
Napier City Council
mailto:[EMAIL PROTECTED]
http://www.napier.govt.nz

Public Key
http://search.keyserver.net:11371/pks/lookup?op=get&[EMAIL PROTECTED]




##
Attention: 
This e-mail message and accompanying data may contain information that
is confidential and subject to legal privilege. Any information
provided is given in good faith. However unless specifically stated to
the contrary, Napier City Council accepts no liability for the
content of this e-mail or for the consequences of any action taken on
the basis of the information provided, unless that information is
subsequently confirmed in writing. If you are not the intended recipient,
you are notified that any use, dissemination, distribution or copying
of this message or data is prohibited. If you received this e-mail
message in error, please notify us immediately and erase all copies
of this message and attachments. Thank you.

-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11799



RE: MI-L TFW - TAB

2004-05-17 Thread David Reid
WorldReg from Data Directions http://www.members.aol.com/mapdata/ works very
well. The standard version is Freeware
http://members.aol.com:/mapdata/WorldReg.mbx.

David Reid
Colbert County E 9-1-1




-Original Message-
From: Ian Tidy [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 7:05 PM
To: MapInfo-L
Subject: MI-L TFW - TAB


Hello,

Does anyone know of or have a tool for converting TFW files to TAB files (or
create TAB files from TFW)?

Cheers Ian
-- 
Ian Tidy
GIS Administrator
Works Asset
Napier City Council
mailto:[EMAIL PROTECTED]
http://www.napier.govt.nz

Public Key
http://search.keyserver.net:11371/pks/lookup?op=get&[EMAIL PROTECTED]
nz




##
Attention: 
This e-mail message and accompanying data may contain information that is
confidential and subject to legal privilege. Any information provided is
given in good faith. However unless specifically stated to the contrary,
Napier City Council accepts no liability for the content of this e-mail or
for the consequences of any action taken on the basis of the information
provided, unless that information is subsequently confirmed in writing. If
you are not the intended recipient, you are notified that any use,
dissemination, distribution or copying of this message or data is
prohibited. If you received this e-mail message in error, please notify us
immediately and erase all copies of this message and attachments. Thank you.

-
List hosting provided by Directions Magazine | www.directionsmag.com | To
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11799




-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11800



MI-L Converting Deg decimal minutes to Decimal Degrees

2004-05-17 Thread Pete Smyth
G'day all
 
Does anyone have or can point me to an application that converts Degrees decimal 
minutes to Decimal Degrees for different Co-ord systems
 
Thanks in advance
 
Pete
 
_
 
Pete Smyth
GIS Support Specialist
GIS Support Services
iDivision
Brisbane City Council
Tel: +61 7 340 34345
Fax: +61 7 340 39072
Email:  [EMAIL PROTECTED]
 
www.brisbane.qld.gov.au
_




This message has passed through an insecure network.
All enquiries should be directed to the message author



MI-L Labelling expression help needed

2004-05-17 Thread David Reid
Greetings List,

I wish to label a map with an expression that would display all characters
of a string until a second space is encountered.

Example:

"Lot 1 in blk 2 of Mapinfo Estates"

I need to extract "Lot XX".

To return:

Lot 5
Lot 34
Etc.


Thanks in advance.
David Reid


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11802



MI-L Deleteing a record from a table that has no object attached

2004-05-17 Thread Sam Shelley
Hi 

 

Does anyone know how to delete a record from a table that has no object
attached to it, using MB.  Thanks heaps

 

Samuel Shelley

GIS OFFICER 

FIRE MANAGEMENT UNIT

 

TASMANIA FIRE SERVICE

GPO Box 1526 
HOBART,  Tasmania
AUSTRALIA, 7001

 

(CNR ARGYLE AND MELVILLE STS, HOBART 7000)

EMAIL: [EMAIL PROTECTED]

PHONE: (03) 6230 8735

FAX: (03) 6230 6647

IF CALLING FROM OUTSIDE AUSTRALIA REPLACE 03 WITH 613

 



Re: MI-L Deleteing a record from a table that has no object attached

2004-05-17 Thread Robert Crossley
Just use the query as below:
Select * from table where Not Obj Into NoObjects
r
On Tue, 18 May 2004 11:48:59 +1000, Sam Shelley 
<[EMAIL PROTECTED]> wrote:

Hi

Does anyone know how to delete a record from a table that has no object
attached to it, using MB.  Thanks heaps

Samuel Shelley
GIS OFFICER
FIRE MANAGEMENT UNIT

TASMANIA FIRE SERVICE
GPO Box 1526
HOBART,  Tasmania
AUSTRALIA, 7001

(CNR ARGYLE AND MELVILLE STS, HOBART 7000)
EMAIL: [EMAIL PROTECTED]
PHONE: (03) 6230 8735
FAX: (03) 6230 6647
IF CALLING FROM OUTSIDE AUSTRALIA REPLACE 03 WITH 613


--
Robert Crossley
Agtrix P/L
9 Short St
PO Box 63
New Brighton 2483
Far Southern Queensland
AUSTRALIA
153.549004 E 28.517344 S
P: 02 6680 1309
F: New Connection
M: 0419 718 642
E: [EMAIL PROTECTED]
W: www.agtrix.com
W: www.wotzhere.com
-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11804


Re: MI-L TFW - TAB

2004-05-17 Thread Ian Tidy
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thanks to those who replied.

Because of the number of file I needed to process, I decided to write a small
application to do this for me.

Cheers Ian

Ian Tidy wrote:
> Hello,
>
> Does anyone know of or have a tool for converting TFW files to TAB files (or
> create TAB files from TFW)?
>
> Cheers Ian

- --
Ian Tidy
GIS Administrator
Works Asset
Napier City Council
mailto:[EMAIL PROTECTED]
http://www.napier.govt.nz
- 
Public Key
http://search.keyserver.net:11371/pks/lookup?op=get&[EMAIL PROTECTED]
- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAqY816Fx3qA5Z0mgRAuUQAJ0VVHHdisUR4l8qW09doFGXL1JBfwCgnPq9
lisJtXFu1KlZzmrcVIFzGX0=
=rBII
-END PGP SIGNATURE-

##
Attention: 
This e-mail message and accompanying data may contain information that
is confidential and subject to legal privilege. Any information
provided is given in good faith. However unless specifically stated to
the contrary, Napier City Council accepts no liability for the
content of this e-mail or for the consequences of any action taken on
the basis of the information provided, unless that information is
subsequently confirmed in writing. If you are not the intended recipient,
you are notified that any use, dissemination, distribution or copying
of this message or data is prohibited. If you received this e-mail
message in error, please notify us immediately and erase all copies
of this message and attachments. Thank you.

-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11805