Peter, Received and fully understood, thankyou very much for your valuable input. I will take this very basic lesson and further implement it by writing this into my first MBX, using my rudimentary skills in MapBasic, to prevent bruising my finger each time I hit the "Enter" button!!
Regards, Chris Chris Brown - GIS Admin/Cartographer Strategic Assets Rio Tinto Iron Ore Tel. +61 8 9327 2176 Fax. +61 8 9327 2478 Mob. 0412 358 640 mailto:[EMAIL PROTECTED] http://www.hamersleyiron.com/ This email (including all attachments) is the sole property of Rio Tinto Limited and may be confidential. If you are not the intended recipient, you must not use or forward the information contained in it. This message may not be reproduced or otherwise republished without the written consent of the sender. If you have received this message in error, please delete the e-mail and notify the sender. From: Peter Horsbøll Møller [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 August 2005 6:14 PM To: Brown, Christopher (RTIO) Cc: [email protected] Subject: RE: MI-L Update Column with Table_Name? Chris, Let's start with your way of doing it. That should work and I think the problem right now is that you are missing a few words in your command: Line 2 should be like this: 2. Update M20542CU Set SHEET_ID = TableInfo("M20542CU",1) but you don't actual need the TableInfo() function here, because you already know the name of the table: M20542CU. So you can change line 2 to: 2. Update M20542CU Set SHEET_ID = "M20542CU" My solution is some what more tricky, but you don't need to write that much. I used 19 in stead of 1 in the TableInfo() function, because I understood that you wanted the name of tab file, not just the name of the table. It is actually 3 statements. I just put them into a single line, to make it easier to execute them in the MapBasic window: Update TableInfo(1,1) Set SHEET_ID = TableInfo(1,1) Commit Table TableInfo(1,1) Close Table TableInfo(1,1) The statements update the table, saves the changes and closed the table. Next time the statements are executes a different table has become table 1 as the previous was closed. Remember that the function TableInfo(1,1) returns the name of the table that is the first in the list of open table. Did this make it more understandable ? if not let me know Peter Horsbøll Møller GIS Developer, MTM Geographical Information & IT COWI A/S Odensevej 95 DK-5260 Odense S. Denmark Tel +45 6311 4900 Direct +45 6311 4908 Mob +45 5156 1045 Fax +45 6311 4949 E-mail [EMAIL PROTECTED] http://www.cowi.dk/gis COWI har fået ny hjemmeside. Ydelserne GIS og IT, kort, kortlægning, 3D visualisering og arealforvaltning ligger under SAMFUND. Se mere her : www.cowi.dk COWI has changed its homepage. Our services within cadastre and landadministration, geodataproducts, mapping and GIS can be seen under SOCIETY. See our services here: www.cowi.com -----Original Message----- From: Brown, Christopher (RTIO) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 10:44 AM To: Peter Horsbøll Møller Cc: [email protected] Subject: RE: MI-L Update Column with Table_Name? Thanks Peter, Further investigation into this reveals that I was wrong about the TableInfo function not working in the MapBasic window. Thanks to those that corrected me. I should read the manual!! I am slightly confused though, regarding the statements you told me to write into the MapBasic window. Here is a scenario I successfully worked on as an example on what I am trying to do. Objective: Add one column to the table structure of many open tables. 1. List all the table names which are open in a text editor. 2. Edit the list to the correct MapBasic command to add the new column. e.g. Alter Table "M20542CU" ( add Sheet_id Char(50) ) Interactive Alter Table "M20542HY" ( add Sheet_id Char(50) ) Interactive Alter Table "M20542OR" ( add Sheet_id Char(50) ) Interactive etc. etc. 3. Copy and paste all the above statements into the MapBasic window, highlight them all and hit enter. 4. This adds the column to all the open tables. Now what I want to do is: Objective: Update the new column "Sheet_id" with the table name i.e M20542CU 1. What would be the statement to type in order to do this? 2. I tried Set SHEET_ID = TableInfo("M20542CU",1) but this came up with ! Invalid clause [Sheet_id] in [set] command. Understood my mistake! I am not sure I can follow your instructions to accomplish what I wish to do similarly to the above first scenario? Regards, Chris Chris Brown - GIS Admin/Cartographer Strategic Assets Rio Tinto Iron Ore Tel. +61 8 9327 2176 Fax. +61 8 9327 2478 Mob. 0412 358 640 mailto:[EMAIL PROTECTED] http://www.hamersleyiron.com/ This email (including all attachments) is the sole property of Rio Tinto Limited and may be confidential. If you are not the intended recipient, you must not use or forward the information contained in it. This message may not be reproduced or otherwise republished without the written consent of the sender. If you have received this message in error, please delete the e-mail and notify the sender. From: Peter Horsbøll Møller [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 August 2005 2:04 PM To: Brown, Christopher (RTIO) Cc: [email protected] Subject: RE: MI-L Update Column with Table_Name? Chris, When you say that TableInfo() doesn't work, are you then refering to TableInfo(1,19) ? Here is what I would recommend that you do: 1. Open all the tables that should be updated (I assume that the column to be updated already exists?) 2. Open the MapBasic window 3. Write this into the MapBasic window: Update TableInfo(1,1) Set TABFILENAME = TableInfo(1,19) Commit Table TableInfo(1,1) Close Table TableInfo(1,1) Note that - these commands update, save and close the table. In this way the first table will be a different one next time - I assume that the name of the column to hold the file name is TABFILENAME, change it if necessary 4. Now place the cursor in the line and hit enter until you get the message "Table 1 is not open" or something similar I know this isn't as smart as a loop but it works ! Peter Horsbøll Møller GIS Developer, MTM Geographical Information & IT COWI A/S Odensevej 95 DK-5260 Odense S. Denmark Tel +45 6311 4900 Direct +45 6311 4908 Mob +45 5156 1045 Fax +45 6311 4949 E-mail [EMAIL PROTECTED] http://www.cowi.dk/gis COWI har fået ny hjemmeside. Ydelserne GIS og IT, kort, kortlægning, 3D visualisering og arealforvaltning ligger under SAMFUND. Se mere her : www.cowi.dk COWI has changed its homepage. Our services within cadastre and landadministration, geodataproducts, mapping and GIS can be seen under SOCIETY. See our services here: www.cowi.com -----Original Message----- From: Brown, Christopher (RTIO) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 5:03 AM To: MapInfo-L Subject: MI-L Update Column with Table_Name? List, I need to update a character column in 140+ MapInfo tables with the filename of the table? Normally I run multiple commands in the MapBasic window to say update the structure of multiple tables i.e. Alter Table "M20542CU" ( add Sheet_id Char(50) ) Interactive My MapBasic skills rise only to the MapBasic window in MI Pro and the function "TableInfo" does not work (MI Pro v7.5). Therefore I can only assume that this could be done in MapBasic. But how? Would anyone be able to point me in the right direction of an existing MBX or supply me with some simple code to help me on my way with a newly installed MapBasic v7? Regards, Chris Chris Brown - GIS Admin/Cartographer Strategic Assets Rio Tinto Iron Ore Tel. +61 8 9327 2176 Fax. +61 8 9327 2478 Mob. 0412 358 640 mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> .riotinto.com.au http://www.hamersleyiron.com/ <http://www.hamersleyiron.com/> This email (including all attachments) is the sole property of Rio Tinto Limited and may be confidential. If you are not the intended recipient, you must not use or forward the information contained in it. This message may not be reproduced or otherwise republished without the written consent of the sender. If you have received this message in error, please delete the e-mail and notify the sender. --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 17465
