axapta - Getting array from .Net parm method -


i trying use .net class microsoft.visualbasic.fileio.textfieldparser read in csv. problem having value of variable netarray appears being set single string, without values being split separate array entries. idea why happen?

int counter, xpparraylength; str xppvalue; str arr[]; system.string[]     netarray; system.string[]     delimeters = new system.string[1](); microsoft.visualbasic.fileio.textfieldparser parser = new microsoft.visualbasic.fileio.textfieldparser(mypath);  delimeters.setvalue(",",0); parser.set_delimiters(delimeters); parser.set_hasfieldsenclosedinquotes(true);  netarray = parser.readline();  while(netarray.get_length()) {     xpparraylength = netarray.get_length();     for(counter = 1; counter <= xpparraylength; counter++)     {         xppvalue = netarray.getvalue(counter-1);         arr[counter] = xppvalue;      }      netarray = parser.readline(); 

} }

because textfieldparser.readline() supposed return single string (as documented here https://msdn.microsoft.com/en-us/library/6a8fts4w%28v=vs.90%29.aspx)

you should doing parser.readfields() (https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.fileio.textfieldparser.readfields%28v=vs.110%29.aspx)

also you've not set textfieldtype = fieldtype.delimited (as documented here https://msdn.microsoft.com/en-us/library/63k8k5sx%28v=vs.90%29.aspx) textfieldtype default value fieldtype.delimited, no need set it.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -