It sounds like you want to insert multiple records into a table using Nav 2009 web services. Unfortunately, you can't pass record type variables as parameters to a CodeUnit-based web service. You'll need to create a web service based on a Page to do this. Then you can do CRUD (Create, Read, Update, Delete) operations on the table by calling the appropriate functions on the web service.
You can use Arrays, but this is really not a desired solution for passing records around. It is much more overhead and you will have problems if you try to use multi-dimensional arrays over the web services. Also you constantly have to code around the fact that NAV indexes at '1' and in nearly all other languages indexing is at '0'. Also in C# sharp you need to declare your Array with the correct number of elements, unlike VB.net where you can re-dimension your array... so if using an array in C# you need to know how big the array is that you are receiving back to declare it and get the contents.
XMLDocument into BigText would work, but again you have the overhead handling your BigText on the NAV side, which you don't have with Pages. Transposing your dt->XML (and vice versa) is really easy in .NET however it is just as easy to create a generic function which takes your returned Page read Object and converts it to a data table or a data set (data table is quicker than data set).
So use Pages from your project and then translate your returned page object to a data set or data table using a generic C# class.
I'm using navision customer webservice and calling the Create, Read, Update, Delete methods in a C# project (WCF Technology), I have a little problem calling the update and the delete methods :oops:
How can I update the appropriate customer record? What's the right instruction to use to update and to delete a customer record?
Thank you for your help but one more question the "pCustomerNo" is a key that I will choose how will I tell the WS that my key in this case is the customer No knowing That I have more than one key in my table :oops:
Read will always be used when you are reading in one record. Similar to a GET in NAV. If you want to read in multiple records then you must use ReadMultiple passing in an array of filter values. You will then be returned a collection of records to work with.
So you are doing a Read on the Customer No. and then doing an update. So why do you have the code in the middle building the FilterArray as from what I can see you are not using this...
I'm Updating the Navision record customer related to the customer record coming from the extranet by parameter, so I have to read the customer form nav filtring on the Nav.No_Customer_Extranet= Customer_Extranet.RefCustomerNo
Comments
Visit the documentation at http://msdn.microsoft.com/en-us/library/dd355316.aspx to see how to surface a Page-based web service.
Tim Larson
You can also use arrays parameters in the codeunit.
This allows you to describe how the scructure needs te be uploaded to the server.
You can use Arrays, but this is really not a desired solution for passing records around. It is much more overhead and you will have problems if you try to use multi-dimensional arrays over the web services. Also you constantly have to code around the fact that NAV indexes at '1' and in nearly all other languages indexing is at '0'. Also in C# sharp you need to declare your Array with the correct number of elements, unlike VB.net where you can re-dimension your array... so if using an array in C# you need to know how big the array is that you are receiving back to declare it and get the contents.
XMLDocument into BigText would work, but again you have the overhead handling your BigText on the NAV side, which you don't have with Pages. Transposing your dt->XML (and vice versa) is really easy in .NET however it is just as easy to create a generic function which takes your returned Page read Object and converts it to a data table or a data set (data table is quicker than data set).
So use Pages from your project and then translate your returned page object to a data set or data table using a generic C# class.
I'm using navision customer webservice and calling the Create, Read, Update, Delete methods in a C# project (WCF Technology), I have a little problem calling the update and the delete methods :oops:
How can I update the appropriate customer record? What's the right instruction to use to update and to delete a customer record?
Thanks for your Help. :thumbsup:
Hanen TALBI
Firstly Read the customer you want to update.
Such as
Customer myCustomer = ws.Read(pCustomerNo);
Then set the fields you want to update such as
myCustomer.Name = 'Joe Bloggs'
then call
ws.Update(ref myCustomer);
Good Luck!
Hanen TALBI
Hope that helps
Adrian
Hanen TALBI
You have applied some filters and called the update but you do not have the actual Customer record filters applied...
Are you not getting problems with this code...?
Hanen TALBI
Hanen TALBI
Because I can't see that the code you posted will work as there is no Read or ReadMultiple.