Can codeunit accept Dataset/Datatable as parameter ?
casanova
Member Posts: 194
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 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
0
Comments
-
you need to pass the data in text format (string)
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 NAV0 -
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?0 -
i thought use string before...
but how about if my file is more than 1024 character
i thought text in NAV variable max is 1024 character0 -
how to use this big text anyway
lets say i have xml file from outside
C:\Sample.xml
and then i want to import this xml fileXMLFile := 'C:\Sample.xml' TestFile.Read(XMLFile); ImportData(TestFile);
failed0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions