Hi Hayden,
 
You need to employ an "alias" type variable to get the values rom the table.
 
It assigns like a string, but returns the field value when used in place of an _expression_.
 
Dim myTableName, myColumnName1 as string
Dim a as alias
Dim s as string 'e.g.
 
a = myTableName + "." + myColumnName1
s = a
 
HTH
 
Best regards / Med venlig hilsen
Lars I. Nielsen
--------------------------------------------------------
Hvenegaard A/S
Rugaardsvej 55, DK-5000 Odense C
Denmark
Tel. +45 6313 5050
http://www.hvenegaard.dk
----- Original Message -----
Sent: Tuesday, September 26, 2006 1:53 AM
Subject: [MI-L] Loop through columns dynamically viewing values

Hi all,

 

I trying to loop through an Excel spreadsheet. The first record holds the column titles. So I need to loop through the columns checking the values and matching them up to the array shown below.

 

The problem I’m having is getting the column value with the column title as a variable and analyzing it.

 

Dim arrStrTableFields1(7)

Dim arrStrTableFields2(7)

arrStrTableFields1(1) = "Asset_ID"

arrStrTableFields1(2) = "Status"

arrStrTableFields1(3) = "Material"

arrStrTableFields1(4) = "Diameter"

arrStrTableFields1(5) = "US_Invert_Level"

arrStrTableFields1(6) = "DS_Invert_Level"

arrStrTableFields1(7) = "Depth_of_cover"

 

Select * From tempAttributeTable Where ROWID=1 into tblTempColumns

For y = 1 to TableInfo(tblTempColumns,TAB_INFO_NCOLS)

            strColumnName = ColumnInfo(tblTempColumns, "COL"+y, COL_INFO_NAME)

           

            For x = 1 to UBound(arrStrTableFields1)

                        ‘*********This is the problem here, accessing the column through a variable

                        If (tblTempColumns.strColumnName = arrStrTableFields1(x))Then

                                    arrStrTableFields2(x) = strColumnName

                        End If

            Next

Next

 

Hayden Fisher

[EMAIL PROTECTED]

 


_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to