add column strange behaviour

25 views
Skip to first unread message

kompas

unread,
Nov 25, 2009, 7:21:39 PM11/25/09
to MapInfo-L
My code is:
run command "add column PT(" + markabs + ") from sel set to sumy where
teryt = teryt"
markabs is a variable with the value "audi"

It works but produces unexpected results:

Part of the sel table:
teryt marka sumy
3001011 Audi 12
3001032 Audi 16
3001043 Audi 7
3001022 Audi 9
3001044 Audi 6
3001053 Audi 5

Part of the output in PT:
teryt Audi
3001011 0
3001022 0
3001032 0
3001043 0
3001044 0
3001053 6

As you can see the values sumy vs Audi for don't match although teryt
values do match.
I'm doing it late in the night. Did I miss something obvious here?
TIA
Jakub

Warren Vick

unread,
Nov 26, 2009, 6:38:02 AM11/26/09
to mapi...@googlegroups.com
Hello Jakub,

If your string markabs variable contains "audi" including the quotes, that may be the problem. Otherwise, the syntax seems OK.

Regards,
Warren Vick
Europa Technologies Ltd.
http://www.europa.uk.com
--

You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To post to this group, send email to mapi...@googlegroups.com.
To unsubscribe from this group, send email to mapinfo-l+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mapinfo-l?hl=en.


kompas

unread,
Nov 26, 2009, 2:54:46 PM11/26/09
to MapInfo-L
Hi Warren,
the variable stores audi with no quotation marks.
Besides, the program do fill the right column, it's just that the
values and rows are wrong.
Any other ideas?
J

On 26 Lis, 12:38, Warren Vick <wv...@europa.uk.com> wrote:
> Hello Jakub,
>
> If your string markabs variable contains "audi" including the quotes, that may be the problem. Otherwise, the syntax seems OK.
>
> Regards,
> Warren Vick
> Europa Technologies Ltd.http://www.europa.uk.com

Peter Horsbøll Møller

unread,
Nov 26, 2009, 3:55:20 PM11/26/09
to mapi...@googlegroups.com
Jakub,

The code does work. I have just tried it with the small sample tables you showed in your first email.
The problem might be that the value in TERYT in the table SEL isn't unique - does each of these values appear multiple times in that table?

If so MapInfo might only keep the last value.
I noticed that the value 3001053 was assigned a value of 6, not 0 as the other records. That might indicate that the codes might appear multiple times in the SEL table.

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


2009/11/26 kompas <zbudni...@interia.pl>

kompas

unread,
Nov 29, 2009, 4:33:04 PM11/29/09
to MapInfo-L
Hi Peter,

I wish it was like that, but I just checked (by grouping and counting)
and teryt entries are all unique. I applied the same test for PT and
the result was the same.
What's more, I made the following command:
Add Column "PT" (TERYT_2 Char (10))From sel Set To TERYT Where COL1 =
COL1 Dynamic
where col1 is Teryt in both the tables and guess what the output is:
teryt teryt_2
3001011
3001022
3001032
3001043
3001044
3001053 3007052
3001054 3010112
3002011 3012044
so the problem is in matching records. Can I do anything about it?
Bug?
I just noticed that the matching is correct when applied to the saved
(commited) sel (sel is the name of the selection). Is there an issue
with updating tables with values from selection that I'm not aware of?

Jakub

On 26 Lis, 21:55, Peter Horsbøll Møller <mapinf...@horsboll-moller.dk>
wrote:
> Jakub,
>
> The code does work. I have just tried it with the small sample tables you
> showed in your first email.
> The problem might be that the value in TERYT in the table SEL isn't unique -
> does each of these values appear multiple times in that table?
>
> If so MapInfo might only keep the last value.
> I noticed that the value 3001053 was assigned a value of 6, not 0 as the
> other records. That might indicate that the codes might appear multiple
> times in the SEL table.
>
> Peter Horsbøll Møller
> Pitney Bowes Business Insight - MapInfo
>
> 2009/11/26 kompas <zbudniewk...@interia.pl>

kompas

unread,
Dec 10, 2009, 9:18:24 PM12/10/09
to MapInfo-L
Just the follow up of the above topic :)
Is there an issue with updating tables with values from selection that
makes it (sometimes?) necessary to save the selection to the file,
open it and then use it to populate other table with values?

Jakub

Peter Horsbøll Møller

unread,
Dec 11, 2009, 2:45:11 AM12/11/09
to mapi...@googlegroups.com
Jakub,
 
I just tried to reproduce the scenario that I think you have - please correct me if I'm wrong.
 
I think you are trying to do this:
 
Dim markabs As String
For i = 1 To 2
   Do Case i
      Case 1
         markabs = "AUDI"
      Case 2
         markabs = "SKODA"
   End Case
   Select * From CARS
      Where MARKA = markabs Into SEL
 
   Run command "add column PT(" + markabs + ") from sel set to SUMY where TERYT = TERYT"
Next
 
This does work quite well on my computer with a limited test dataset.
I have only two cars (AUDI and SKODA). I copied the records for Audi to Skoda and changed the SUMY by multiplying by 10.
 
This is the final table:
TERYT   AUDI   SKODA
3001011   12     120
3001032   16     160
3001043    7      70
3001022    9      90
3001044    6      60
3001053    5      50
 
I have no idea what TERYT means ? Is that a reseller?
 
I have tested this with Mi Pro v10.0
 

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

2009/12/11 kompas <zbudni...@interia.pl>
]
--

You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To post to this group, send email to

To unsubscribe from this group, send email to

For more options, visit this group at

Reply all
Reply to author
Forward
0 new messages