Problem with options Automatic ApplyUpdates of COMMIT TABLE statement in MapInfo 2023

72 views
Skip to first unread message

Evgeny Kleiman

unread,
Nov 5, 2024, 7:14:24 AM11/5/24
to MapInfo-L
In https://groups.google.com/g/mapinfo-l/c/DZq1Pce5u-s was written that
"When creating new tables or files through MapBasic code, you need to specify a fully qualified file path." 
Also I saw that  COMMIT TABLE does not work without  fully qualified file path. 
So I changed my previous code:
 Commit Table Roads      Automatic ApplyUpdates
to
 Commit Table  Roads        as ApplicationDirectory$()& " Roads"
      Automatic ApplyUpdates
But now I get an error message:
 Unrecognized command: Automatic
So how to use "Automatic" now?

Peter Horsbøll Møller

unread,
Nov 5, 2024, 8:41:59 AM11/5/24
to mapi...@googlegroups.com

Hi

 

You only need to use the fully qualified path with Commit when you are creating a copy of the table.

If you just are commit the current changes to the existing table, it’s fine just to specify the table name:

 

Commit Table Roads Automatic ApplyUpdates

 

Cheers

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Evgeny Kleiman
Sent: 5. november 2024 13:14
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Problem with options Automatic ApplyUpdates of COMMIT TABLE statement in MapInfo 2023

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
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.
To view this discussion visit https://groups.google.com/d/msgid/mapinfo-l/b4028974-11d0-473e-ab3d-1d2687a69adfn%40googlegroups.com.

Evgeny Kleiman

unread,
Nov 5, 2024, 11:33:00 AM11/5/24
to MapInfo-L
Peter, thank you for you answer.
It seems that COMMIT TABLE does not make changes in tables without full path. I prepared 2 .mb files
The first one
Declare sub Main
'Test open table and commit. This code works for MapInfo 2019 but does not change table in MapInfo 2023
Sub Main 
 Open Table  "Kvishim.tab" as "Kvishim"
 Update Kvishim  
 set length=3642419.47
 commit table  Kvishim
 close table "Kvishim"
End Sub

---
This code does not changes table Kvishim
---------------------
The second one
Declare sub Main
'Test open table and commit. This code works for MapInfo 2023 but gives error with MapInfo 2019
Sub Main 
 Open Table  "Kvishim.tab" as "Kvishim" 
 Update Kvishim  
 set length=3642419.47
 commit table  Kvishim as ApplicationDirectory$()& "Kvishim.tab"
 close table "Kvishim"
End Sub
-----
This code makes changes in table Kvishim

So I have a problem.
Evgeny

Peter Horsbøll Møller

unread,
Nov 6, 2024, 2:07:26 AM11/6/24
to mapi...@googlegroups.com

That’s not the case. There must be something else going here.

 

Is the table in question a normal Native MapInfo table?

Or is it connected to a database?

 

When you use this statement:

Commit Table some_table as some_file

You create a copy of your table

 

When you use this statement:

Commit Table some_table

You save the changes to the existing table.

Evgeny Kleiman

unread,
Nov 6, 2024, 5:38:27 AM11/6/24
to MapInfo-L
Hello,
Firstly answer to the question:
Is the table in question a normal Native MapInfo table?
Yes and it is not connected to database.
I changed my sample to the following one:
Declare sub Main
'Test open table.update and commit.
Sub Main
 Print "Test 1: Open Table"
 print ApplicationDirectory$()& "Kvishim.tab"
 Open Table ApplicationDirectory$()&  "Kvishim"
 'Fetch first From Kvishim
 Update "Kvishim"
 set length=1

 commit table  "Kvishim"
 close table "Kvishim"
End Sub
---
and this code really changes the table. But without  ApplicationDirectory$()&  it does not change. So my question: is it true that I must add  ApplicationDirectory$()& in Open Table statement?

Also I made the second sample that works with table DCcounties from MapInfo directory. I copied all files of this table into folder of .mb file:
Declare sub Main
'Test open table and commit.
Sub Main
 Print "Test 1: Open Table"
 print ApplicationDirectory$()& "DCcounties.tab"
 Open Table ApplicationDirectory$()&  "DCcounties"
 Update "DCcounties"
 set A2_code=222
 commit table  "DCcounties"
 close table "DCcounties"
End Sub
--
This code also works. But without  ApplicationDirectory$()&   in Open Table  it does not work with the following error message:
(testdccounties.mb:6) File DCcounties not found. Unable to open table DCcounties

So I do not understand this difference.
Evgeny

Uffe Kousgaard

unread,
Nov 6, 2024, 5:51:37 AM11/6/24
to mapi...@googlegroups.com
Hi,

You may have multiple copies of your Kvishim table in different folders, so it does make a change, but you are looking into a different copy when checking the result.

Using a fully qualified path is the correct way, in any case.

Regards
Uffe

Uffe Kousgaard

unread,
Nov 6, 2024, 5:55:37 AM11/6/24
to mapi...@googlegroups.com
Hi,

Tableinfo(....,TAB_INFO_TABFILE) gives you the full path of your TAB file.
If you don't know where it was opened from.

Regards
Uffe


On 06-11-2024 11:38, Evgeny Kleiman wrote:

Evgeny Kleiman

unread,
Nov 6, 2024, 6:11:42 AM11/6/24
to MapInfo-L
Hi,
I understand that "Using a fully qualified path is the correct way," but there are hundreds of Open Table statements in my files and to add fully qualified path is a problem.  So I need to know is there a solution to avoid this operation.
Reply all
Reply to author
Forward
0 new messages