Dienstag, 20. November 2007

Get data from a WebService

Getting data from a webservice is pretty easy, but the first time I had the problem that the ResultEvent object had two different definitions, one when there is only one line in the table and the second when there is more than one line in the table.
When the query returns only one line the type of the event.result object is ObjectProxy, if the query returns more than one line the definition is an Array.
I can check this with a very simple static function that I put in an utility class. The function looks like this:


public static function IsObjectArray(obj: Object): Boolean
{
var className: String = ObjectUtil.getClassInfo(obj).name;
if (className=="mx.collections::ArrayCollection"){
return true;
}
return false;
}



Now when you getting data from a webservice you only have to do things link this:


private function getSomeDataFromMyWebservice(event: ResultEvent): void{
if (event.result){
if (.IsObjectArray(event.result)){
for each(var item: Object in event.result){
}
}else{
//event.result is from type Object.
}
}

Sonntag, 11. November 2007

Flex Builder 3 Beta 2 design view doesn't show anything

I had this problem a few times. I thought it came from my own designed components but it also happened in my application component. Here is a link to solve this problem... The solution is pretty easy and works fine!

Mittwoch, 7. November 2007

SQL Script : Export Database

Here is a SQL Script that I use to export all the data from one MSSQL database to an other MSSQL.
It's very usefull when you quickly want to have the same database on your development machine but you are not able to backup the original database, because you don't have enought rights.

The file can be download here