• passing in a dataset to a BASIC function

    Hi there
    I'm porting over some automate 9 tasks to automate 11 and have run into a roadblock.

    in automate 9 
    i could pass a dataset to a BASIC function - see example below
    but now it comes back as an invalid type error in automate 11

    nRows = Eval(dsName & ".TotalRows")  is the line it fails on.  This function works perfectly fine in automate 9

    From automate 11 the steps are:
    <AMFILESYSTEM ACTIVITY="csv_to_dataset" SOURCE="%csvFile%" RESULTDATASET="ds" ROWASHEADER="NO" />
    <AMVARIABLE ACTIVITY="set" VARIABLENAME="html">%DatasetToHTMLTable ("ds")%</AMVARIABLE>


    Any advice?

    thanks
    Eric




    Public Function DatasetToHTMLTable (dsName)
        ' dsName is the name of the dataset as a String (don't forget to enclose it in quotes)   
       
        Dim html,nRows,nCols,i,j,css,colName
    
        nRows = Eval(dsName & ".TotalRows")
        nCols = Eval(dsName & ".TotalColumns")
       
        css =  "<style>" & vbCrLf &"table, td, th {" & vbCrLf & "    border: 1px solid black;" & vbCrLf & "}" & vbCrLf & "table {" & vbCrLf & "    width: 100%%;" & vbCrLf & "    background-color:#ffffff;" & vbCrLf & "    border-collapse:collapse;" & vbCrLf & "    text-align:center;" & vbCrLf & "}" & "th {" & vbCrLf & "    height: 50px;" & vbCrLf & "    background-color:#6FA1D2;" & vbCrLf & "    color:#fff;" & vbCrLf & "}" & "</style>"  & vbCrLf
    
        html = css & "<table>" & vbCrLf
         
        For j = 1 To nRows
            html = html & "<tr style =color:#555555;>"
            For i = 1 To nCols
                colName = "Column" & i
                html = html & "<td>" & Eval (dsName & "(j)." & colName ) & "</td>"
            Next
            html = html & "</tr>" & vbCrLf
        Next
    
        html = html & "</table>"
    
        DatasetToHTMLTable = html
    End Function