Problems getting a dataSource from a dataSet

Hi, I´m having problems getting a dataSource from a dataSet, I always get a null result.

As you can see in the console result I have the dataSet and I can event get HTML from it, but the dataSource is not created.

Servoy version 5.2.11

=>globals.gJurisdiction
BufferedDataSet {Columnnames[citydisplay, cstate, ccounty, ccity, centity1, centity2, centity3, centity4, centity5, centity6, centity7, centity8, centity9, ntaxrate1, ntaxrate2, ntaxrate3, ntaxrate4, ntaxrate5, ntaxrate6, ntaxrate7, ntaxrate8, ntaxrate9]} 
row_1[Los Angeles                        , CA, Los Angeles                        , , Los Angeles                        , CA        , CA001     , CA00100203,           ,           ,           ,           ,           ,           , 7.25, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 
row_2[Playa Del Rey                      , CA, Los Angeles                        , , Playa Del Rey                      , CA        , CA001     , CA00104803,           ,           ,           ,           ,           ,           , 7.25, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]  {rowColumns:array[22],rowIndex:-1,row_1:array[23],row_2:array[23]}
=>_uri
null
=>globals.gJurisdiction.getAsHTML()
"<TABLE CELLPADDING=\"1\" CELLSPACING=\"0\" BORDER=\"1\"><TR class=\"text\"><TD><B>citydisplay</B></TD><TD><B>cstate</B></TD><TD><B>ccounty</B></TD><TD><B>ccity</B></TD><TD><B>centity1</B></TD><TD><B>centity2</B></TD><TD><B>centity3</B></TD><TD><B>centity4</B></TD><TD><B>centity5</B></TD><TD><B>centity6</B></TD><TD><B>centity7</B></TD><TD><B>centity8</B></TD><TD><B>centity9</B></TD><TD><B>ntaxrate1</B></TD><TD><B>ntaxrate2</B></TD><TD><B>ntaxrate3</B></TD><TD><B>ntaxrate4</B></TD><TD><B>ntaxrate5</B></TD><TD><B>ntaxrate6</B></TD><TD><B>ntaxrate7</B></TD><TD><B>ntaxrate8</B></TD><TD><B>ntaxrate9</B></TD></TR><TR class=\"text\"><TD>Los Angeles                        </TD><TD>CA</TD><TD>Los Angeles                        </TD><TD></TD><TD>Los Angeles                        </TD><TD>CA        </TD><TD>CA001     </TD><TD>CA00100203</TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>7.25</TD><TD>1.5</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD></TR><TR class=\"text\"><TD>Playa Del Rey                      </TD><TD>CA</TD><TD>Los Angeles                        </TD><TD></TD><TD>Playa Del Rey                      </TD><TD>CA        </TD><TD>CA001     </TD><TD>CA00104803</TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>          </TD><TD>7.25</TD><TD>1.5</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD><TD>0.0</TD></TR></TABLE>"

Any clue on this??

Can you show the code on how you try to make it into a DataSource ?

Hi Robert.

var ds=globals.gJurisdiction.createDataSource('Jurisdictions')

Hi Juan,

You need to tell it what the datatypes of the columns are in the DataSet. So you pass it an array with JSColumn.* constants that match the columns in your DataSet.

var ds=globals.gJurisdiction.createDataSource('Jurisdictions', [JSColumn.TEXT, JSColumn.NUMBER, etc.])

Hope this helps.

Thanks Robert, I will give it a try. I thought that the data types were found out by Servoy.

Hi Juan,

A dataset based on this query will not let you create a datasource without specifying the type:

var sql="SELECT companyname || ' - ' || contactname from customers";

but this one will:

var sql="SELECT company name, contactname from customers";

which is probably obvious because in the latter the columns can easily be distinguished. In the first example however the output console notified me with a message like this:

Could not find column ‘?column?’ in table ‘mem:myDataSource’.

Do you see any message like this? Because the columns in your dataset don’t look like they are unrelated to table columns. Do you have any calculated columns maybe?