myBlueSky
asked on
Split Sting in ArrayCollection
I have arraycollection items contains list of items;
I need to get the id and the description out of this list to be used in Flex app.
The input is:
private var input:ArrayCollection=new ArrayCollection
([
{ item: "5 Computers HP 125"},
{ item: "125 Monitors LG 54 "},
{ item: "00425 Keyboard AA 58 "},
{ item: "0525 others "}
]);
The output should be
private var output:ArrayCollection=new ArrayCollection
([
{ id: "5", Desc: "Computers HP 125"},
{ id: "125", Desc: "Monitors LG 54"},
{ id: "00425", Desc: " Keyboard AA 58"},
{ id: "0525", Desc: “others"}
]);
I need to get the id and the description out of this list to be used in Flex app.
The input is:
private var input:ArrayCollection=new ArrayCollection
([
{ item: "5 Computers HP 125"},
{ item: "125 Monitors LG 54 "},
{ item: "00425 Keyboard AA 58 "},
{ item: "0525 others "}
]);
The output should be
private var output:ArrayCollection=new
([
{ id: "5", Desc: "Computers HP 125"},
{ id: "125", Desc: "Monitors LG 54"},
{ id: "00425", Desc: " Keyboard AA 58"},
{ id: "0525", Desc: “others"}
]);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Deepanjan
I’m getting error on this statement: value = input.getItemAt(i);
Implicit coercion of a value with static type Object to a possibly unrelated type String
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Set the value to an Object;
var value:Object;
Also @ute_arbeit 's suggestion is good.
Warm Regards
Deepanjan Das
var value:Object;
Also @ute_arbeit 's suggestion is good.
Warm Regards
Deepanjan Das
But I think mine will be better in performance as it uses the same ArrayCollection :)
Warm Regards
Deepanjan Das