@gilanxcheetz : Use loop. If you dig on the js variable in the debug dialog, change value, you can tap the "tickers" and see all the coins map. Loop upon this and store in other list or you can directly create the text to show. I prefer to create a temporary list or map to store the converstion first, because you can do another preprocessing before showing it, or doing some filter.
Code: Select all
js = fromJSON(response);
t = js["tickers"];
tickers = newMap();
for(i in getMapKeys(t))
tickers[i] = newList(t[i]["last"], t[i]["high"], t[i]["low"]);
//tickers contains map | coin name : Last, High, Low
show = "";
for(i in getMapKeys(tickers))
show = show +
"{toUpperCase(i)}\n" +
"Last : Rp. {tickers[i][0],numberformat,#,##0.##}\n" +
"High : Rp. {tickers[i][1],numberformat,#,##0.#}\n" +
"Low : Rp. {tickers[i][2],numberformat,#,##0.##}\n\n";
//this part use the favourite, save the keyword in the fav list
fav = newList("btc_idr", "ten_idr");
showfav = "";
for(i in fav)
showfav = showfav +
"{toUpperCase(i)}\n" +
"Last : Rp. {tickers[i][0],numberformat,#,##0.##}\n" +
"High : Rp. {tickers[i][1],numberformat,#,##0.#}\n" +
"Low : Rp. {tickers[i][2],numberformat,#,##0.##}\n\n";
As you can see above, first I create newmap tickers. Loop upon the js and store all the needed info into this newMap.
Then loop against the new map and put the info on the {show}.
Using temporary map, we can filter out for only some coins. As shown in the favourite part.
You can also use the remove, to show every coin except the ones you don't need. You can also do some calculation and don't include the coin which have value lower than 0. But I will leave that to you first.