Array Madness in 2018


please help!!

  1. I define array
  argusRequest: any = [];

  1. I add data to array
curString = "quantity="+curMed.QTY+"&ndc="+currRow.NDC+"&npilist="+this.pharmacyCommaSep;

  1. i console.log the array
0: "quantity=30&ndc=00143127001&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"
1: "quantity=30&ndc=00143127010&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"
2: "quantity=30&ndc=00172376160&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"
3: "quantity=30&ndc=00172376170&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"
4: "quantity=30&ndc=00185010401&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"

144: "quantity=20&ndc=63304059130&npilist=1700819067,1952316945,1629007653,1033228325,1396771507,1306842752,1548307929"
length: 145

the array in console shows length of 145.

i do…


I get 0 (zero, nada, nothing)
i get an array that I cant iterate thru

I’m at a loss here


The selective quoting makes it impossible to diagnose what is likely a case of code path flow confusion, but there must be a more natural and usable way to structure this data. If it’s being passed as query strings to an HTTP backend, what I would instead do is have an ordinary:

interface Specification {
  quantity: number;
  ndc: string;
  npilist: string[];

…and then when it’s time to feed it to HTTP, use HttpParams. Its constructor can take an object and do pretty much what you would expect it to.


Thanks for response its just simple array

I’m just taking data and trying to create an array of these url params (in string form) that will be used to process multiple requests in a promise.all. the array is a final of several arrays of data building up the full array.

if I could iterate thru this new array then I would join it with the Address or the Proxy, and then process them.


Smacks forehead, it was timing within .then.