Ok I'm going to answer my own question since I figured out how the MapInfo folks are doing it in their Sql Select dialog. The whole thing is a string. Instead of using an alias variable use a string of the column names separated by a comma in a loop. Then create a string containing the whole sql statement including the list of columns in the string produced by the loop then feed it to the sql translator via a run command like so. Also many thanks to Lars for his Variable clarification.
'''''''''''code''''''''''''''' 'Set the original boolean value to cotrol the loop blnContinue = TRUE 'Loop to make a comma delimited string from the selected columns in popupcontrol 3 Do While blnContinue = TRUE Check1 = ReadControlValue(3) If Check1 <> 0 Then ReDim newTableFields(cntr) newTableFields(cntr) = Check1 strColumnList = strColumnList & BaseTable & "." & ColumnInfo(BaseTable,"col" & Check1,COL_INFO_NAME) & ", " cntr = cntr + 1 Else blnContinue = FALSE End If Loop 'Build the column list with the user selected columns and the proportion columns strColumnList = strColumnList & "Sum(ProportionOverlap(" & BaseTable & ".obj," & SubTable & ".obj)*100)" & Chr$(34) & "BaseOverlap" & Chr$(34) & " ," strColumnList = strColumnList & "Sum(ProportionOverlap(" & SubTable & ".obj," & BaseTable & ".obj)*100)" & Chr$(34) & "SubOverlap" & Chr$(34) strColumnList = LTrim$(strColumnList) strColumnList = Rtrim$(strColumnList) 'Build the command string Dim strRunCommand As String strRunCommand = "Select " & strColumnList & Chr$(13) & Chr$(10) strRunCommand = strRunCommand & " From " & BaseTable & "," & SubTable & Chr$(13) & Chr$(10) strRunCommand = strRunCommand & " Where " & BaseTable & ".obj" & " Intersects " & SubTable & ".obj" & Chr$(13) & Chr$(10) strRunCommand = strRunCommand & " Into qryResultsTable" 'Close the dialog Dialog Remove 'Run the command creating the new qryResults table Run Command strRunCommand ''''''''''''''''end code'''''''''''''''''''''''''''''''''' -----Original Message----- From: Canfield, Andrew Sent: Monday, November 18, 2002 2:37 PM To: '[EMAIL PROTECTED]' Subject: MI-L MapBasic Alias Array question I have an array of alias variables each value in the array is a column name in a table. I need to do a proportion overlap query and also include the columns in that array which the user has selected from a popup control of the column names. How do I do it? For example: if aliasColumnList represented these values which the user would have randomly selected: aliasColumnList(1) = mytable.col1 aliasColumnList(2) = mytable.col6 aliasColumnList(3) = mytable.col15 How do I get the following to work? Select aliasColumnList, Sum(ProportionOverlap(BaseTableobj,SubTableobj)*100), Sum(ProportionOverlap(SubTableobj,BaseTableobj)*100) >From BaseTable,SubTable Where BaseTableobj Intersects SubTableobj Into ResultsTable Any help would be greatly appreciated --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 4167