hi all
i create program outside nav
and then it will stored it in dataset
what i want is send this dataset as parameter to codeunit
and then codeunit will proses this dataset to do the process
any clue or sample?
thanks
i would suggest to use binary serialization to serialize your datatable and then use Base64 conversion to receive a string, this one you can pass to the webservice (i guess you use webservices to connect to nav).
public static string Serialize(DataSet ds) {
Stream stream = null;
BinaryFormatter serializer = new BinaryFormatter();
serializer.Serialize(stream, ds);
return Convert.ToBase64String(stream.ToArray());
}
In Nav you can then deserialize the data back to a instance of a DataSet
But since you need to process the data anyway i would suggest to find out if passing an xml data strucutre is more suitable for your task. Becaus if you for example need to import the values of the your DataSet then with an xml strucutre you could use a xmlport and would need very little code to do your task. If you need to process a DataSet in NAV I guess you need lots of code to achieve the same.
So the question is what do you want to do with your DataSet once you have it in NAV
yes correct i'm using webservice
so... from my program it will store in dataset or datatable
after that , i will send this dataset and datatable as a parameter to codeunit
my codeunit will be published as webservice
is it can be done?
Comments
i would suggest to use binary serialization to serialize your datatable and then use Base64 conversion to receive a string, this one you can pass to the webservice (i guess you use webservices to connect to nav).
In Nav you can then deserialize the data back to a instance of a DataSet
But since you need to process the data anyway i would suggest to find out if passing an xml data strucutre is more suitable for your task. Becaus if you for example need to import the values of the your DataSet then with an xml strucutre you could use a xmlport and would need very little code to do your task. If you need to process a DataSet in NAV I guess you need lots of code to achieve the same.
So the question is what do you want to do with your DataSet once you have it in NAV
so... from my program it will store in dataset or datatable
after that , i will send this dataset and datatable as a parameter to codeunit
my codeunit will be published as webservice
is it can be done?
No you cannot pass a dataset directly, as i said you need to serialize your data.
but how about if my file is more than 1024 character
i thought text in NAV variable max is 1024 character
lets say i have xml file from outside
C:\Sample.xml
and then i want to import this xml file
failed