looping through dataset

      var resultDisplayArr = new Array();
      var resultDS = databaseManager.getDataSetByQuery(globals.serverName, SQL, null, 10000);
        for (var i = 1 ; i <= resultDS.getMaxRowIndex() ; i++ ) {
            resultDS.rowIndex = i;
            resultDisplayArr[i] = resultDS[1];
         }
      }

In the line
resultDisplayArr = resultDS[1];
resultDS[1] returns a undefined value.
In previous versions it was returning proper value from the dataset.
Thanks
Hameed

I also noticed some changes in datasets. It seems for example that getColumnAsArray() returns something different now. On of my methods always ran fine and since rc1 produces an error.

Could somebody explain if there has been changes and if yes, which ones?

hameed: what does youre SQL looks like? And why aren’t you use getColumnAsArray()

Patrick: What kind of error do you get now?

Yep, I noticed this too. A method that ran perfectly until b3 now had to be changed…

My SQL looks like the following:

         var SQL = "SELECT " + actualFieldValue + " FROM valuelist " + 
                   "WHERE valuelist_name = '" + valueListName + "' " +
                   "ORDER BY " + actualFieldValue;
         var resultDS = databaseManager.getDataSetByQuery(globals.serverName, SQL, null, 10000);
         var resultDisplayArr = new Array();
         resultDisplayArr[0] = "";
         for (var i = 1; i <= resultDS.getMaxRowIndex() ; i++ ) {
            resultDS.rowIndex = i;
            resultDisplayArr[i] =  resultDS.getValue(i,1);
         }
         application.setValueListItems(valueListName, resultDisplayArr);

Now I am using

resultDisplayArr = resultDS.getValue(i,1);
instead of
resultDisplayArr = resultDS[1];
and it works

found the problem. Should all work again in next release.

cool! thanks!

I use this method, but I don’t recieve data from the .getValue() function.
What’s missing?

var query = "SELECT tariefid, describtion, amount FROM werktijd WHERE orderid LIKE recordstatus = null " ;
var maxReturedRows = 200 ;
var dataset = databaseManager.getDataSetByQuery(currentcontroller.getServerName(), query, null, maxReturedRows);

	for(var i=1; i<= foundset.getSize(); i++) 
	{ 
	//go to record
   var record = foundset.getRecord(i);

	//create new record and insert found record data
	forms.testform.controller.newRecord(); 
	forms.testform.factuurid = factuurid ;
	forms.testform.controller.codeid = dataset.getValue(i,1);
	forms.testform.controller.describtion = dataset.getValue(i,2);
	forms.testform.controller.amount = dataset.getValue(i,3);
	
	//set status on passive
	forms.DEV_werktijd.recordstatus = '2';
	}

Karel,

What are you doing here? I really don’t understand…

It looks like you are mixing a foundset and a dataset or do I misinterpret you code?

Is your currentcontroller really the controller you want (the main form)?

Do you have a column ‘describtion’ or ‘description’? In other words is there a(ny) misspelling in your query?

The field reference ‘forms.testform.controller.xxx’ is wrong. It should be ‘forms.testform.xxx’ without the controller…

TIP: (can’t stress enough)..use code completion!
Might feel a bit clumsy at first but if you stick to it,
it beats typing stuff out yourself AND rules out syntax errors

  1. type “f”
  2. type Ctrl+Spacebar.. etc…

IT2BE:
Karel,

What are you doing here? I really don’t understand…
It looks like you are mixing a foundset and a dataset or do I misinterpret you code?

Hi Marcel! Purpose of this method is to copy data from a foundset into new records in another table. This all happens in a loop.

Is your currentcontroller really the controller you want (the main form)?

The main form that contains the method is called ‘orderdetail’. What I do search all the timesheet records (from the selected order) in the table ‘werktijd’ by a query. After that I copy each found record into the invoice table called ‘factuurregels’ by a loop. It’s a kind of sync method, but then a one way direction.

Do you have a column ‘describtion’ or ‘description’? In other words is there a(ny) misspelling in your query?

I just translated the method (too quick) to clarify it a bit. Made a translation misspelling… sorry for that! :wink:

The field reference ‘forms.testform.controller.xxx’ is wrong. It should be ‘forms.testform.xxx’ without the controller…

Thanks! That solves a lot! What I still don’t get is why not all of the data from the newly made records is copied.. could it be a refresh option?