javascript - Get Unique values during Loop -
i looping through array , getting data need.
(var = 0; < finalarray.length; i++) { var merchname = finalarray[i].merchname; var amname = finalarray[i].amname; var amemail = finalarray[i].amemail; var txnid = finalarray[i].transid; var transaccount = finalarray[i].transaccount; }
what trying @ point show unique data in loop.
for example var transaccount in array 5 times. 1 display in table once. how can go accomplishing ?
final array constructed so; object:
finalarray.push({ transid: tmptrans, transaccount: tmpaccount, amemail: amemail, merchname: merchname, amphone: amphone, amname: amname });
var alltransaccount = {}; (var = 0; < finalarray.length; i++) { var merchname = finalarray[i].merchname; var amname = finalarray[i].amname; var amemail = finalarray[i].amemail; var txnid = finalarray[i].transid; var transaccount = finalarray[i].transaccount; if(alltransaccount[finalarray[i].transaccount]) { var transaccount = ''; } else { alltransaccount[transaccount] = true; } }
Comments
Post a Comment