Unrecognized command "." (Point/dot)

278 views
Skip to first unread message

Zery

unread,
Nov 23, 2010, 8:42:03 AM11/23/10
to MapInfo-L
Hi,

I try to assign an array value to a variable but get this error "Unrecognized command ."

Here's the code:

Dim c_1, c_2 as string
Dim row_id as integer

Fetch first from sTable(tablename)
Do while not eot(sTable(tablename))
c_1=sTable(tablename).sColumn(i1)
c_2=sTable(tablename).sColumn(i2)
row_id=sTable(tablename).rowid

'..........
Loop

And another error is "rowid not defined".

Can someone help ligthning me what's wrong with that code?


Regards,
Zery

Thomas Bacon

unread,
Nov 23, 2010, 9:27:03 AM11/23/10
to mapi...@googlegroups.com
Hi Zery,

From what I can gather it looks like you've forgotten to stick quotes
around your "." in the string you are trying to assign. As for the
rowid, you might need to store the table and field as an alias before
trying to assign it. This should help:

Dim c_1, c_2 as string
Dim row_id as integer

Dim colAlias as Alias

Fetch first from sTable(tablename)
Do while not eot(sTable(tablename))

c_1=sTable(tablename) & "." & sColumn(i1)
c_2=sTable(tablename) & "." & sColumn(i2)
colAlias = sTable(tablename) & ".rowID"
row_id = colAlias

'..........
Loop

Hope that helps!

Tom Bacon
GIS Technician
Asset Management South
Tel: 01444 472380
www.mouchel.com

Hi,

Here's the code:

'..........
Loop


Regards,
Zery

--
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


The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. Mouchel Limited, Registered in England at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX Registered No : 1686040

Zery

unread,
Nov 23, 2010, 7:12:13 PM11/23/10
to mapi...@googlegroups.com
Thanks Tom, but how can be this other code works just fine?

'===============================================
dim new_name as string
dim d_1 as string
dim d_2 as string
dim f_name as string
dim row_id as integer
f_name=fileopendlg("","","tab","Select plant table name")
if f_name="" then exit sub end if
open table f_name as div_plant
fetch first from div_plant
do while not eot(div_plant)
d_1 = div_plant.estate      ' estate is a true column name from div_plant
d_2= div_plant.divisi        '
divisi is a true column name from div_plant
row_id=div_plant.rowid
new_name=d_1 & "_" & d_2
select * from div_plant where rowid=row_id into this_one
commit table this_one as new_name
fetch next from div_plant
loop
close table div_plant
'==============================================

What makes the differences?


Regards,
Zery

Peter Horsbøll Møller

unread,
Nov 24, 2010, 2:48:23 AM11/24/10
to mapi...@googlegroups.com
Zery,
The difference is that in the first case one you used variables to hold table and/or column names and in the second the table and column names are hard coded.
When ever you use a variable for a table or column name, you need to use the Alias variable to point to a "combination". If you have hard coded table and column names you do not need to use a Alias variable, but you could.

Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo


2010/11/24 Zery <zer...@gmail.com>

Zery

unread,
Nov 24, 2010, 4:11:12 AM11/24/10
to mapi...@googlegroups.com
Thank you Peter,

The code is working now, but I must change the variable first to an Alias or else is not working as expected.

Surely not an easy task learn this mapbasic without an experience in programming and a tutor.

Regards,
Zery


From: Peter Horsbøll Møller <mapi...@horsboll-moller.dk>
Date: Wed, 24 Nov 2010 08:48:23 +0100
Subject: Re: [MI-L] Unrecognized command "." (Point/dot)

Uffe Kousgaard

unread,
Nov 24, 2010, 4:49:36 AM11/24/10
to mapi...@googlegroups.com
Learning to program is hard work. At least you have the internet. When I started 28 years ago there was just a short manual and absolutely no-one to ask. Only a few printed magazines if you could afford them or find them at the local library, where someone else most likely had stolen the latest copy.

Your issue in particular:
Especially the alias part of mapbasic is ugly. It is because of mapbasic's scripting-style, but that is also what makes it easy to write small applications. Larger and more flexible applications are not so easy to write, debug or maintain.

Regards
Uffe Kousgaard
Reply all
Reply to author
Forward
0 new messages