For Each

How do you run trough all the elements in a collection in navision? Consider this VB code For Each x In Obj.Collection strTest = x.Text Next How do you do this in Navision?

Could you be a bit more specific. eg. What object are you trying to step through?

Ok this is the function i made in VB, which i now want to convert. Public Function GetQuote() As Integer Dim objDOMDocument As MSXML.DOMDocument Set objDOMDocument = New DOMDocument Dim strURL, strNode As String 'strProdID = strID = strDesc = strPrice = strQty = strDelDate = 0 strURL = “http://intouch.computer2000.com/xml/xmlonl.asp?custid=” + _ strCustID + “&prodid=” + strProdID objDOMDocument.async = False objDOMDocument.Load strURL If objDOMDocument.documentElement.childNodes.Item(0).Attributes.Item(0).Text <> “0” Then strMessage = objDOMDocument.documentElement.childNodes.Item(0).Text GetQuote = 1 Else For Each x In objDOMDocument.getElementsByTagName(“ITEM”).Item(0).childNodes Select Case x.nodeName Case “ID” strID = x.Text Case “DESC” strDesc = x.Text Case “PRICE” strPrice = x.Text Case “QTY” strQty = x.Text Case “DELDATE” strDelDate = x.Text End Select Next GetQuote = 0 End If End Function Sorry that the indenting didn’t come trough… Edited by - dennis decoene on 10/10/00 12:09:57 PM

That sound’s not so difficult: Pseudocode: For Each x In Obj.Collection strTest = x.Text Next CODE: x: record (typeA) CLEAR(x); x.RESET; SetInitializingFiltersUserFunction(x); IF (x.FIND(’-’)) THEN REPEAT IF (TestXinCollectionUserFunction(x)) THEN BEGIN strTest := x.Text // here i suppose you will do something with strtest // or use a texts table and insert a record with the text // or an array… :slight_smile: END; UNTIL (x.NEXT = 0);

I don’t think this task is easy to accomplish. At least not before Fin 3.0 is released which is said (promised at least) to support XML. At the moment I only see two possibilities: 1) Create an OCX or VB-Program which converts the XML attributes and data to flat file which then can be processed by Fin. (Not elegant, I know) 2) Create an XSL to convert the XML to a “Navision-readeable form”. 3) Create an Excel Web-Query which reads the Web-page into an Excel worksheet. Then you can use Excel Automation to retrieve the data from the WS. Marcus Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

XDD you’re right, Fabian… i just had read the first post (and it sounds not difficult), but i didn’t read the others as i was working… (didn’t read about loading pages or anything else… LOL). BTW, do you really think it will be really easier in Navision 3.0?? Would Navision’s team finally add all requests that people has been doing for years (like being able of using jpg’s,showing values of arrays at debugging,… ) and all that things that would make us increase our perfomance using Navision without needing to use OCX controls?? Alfonso Pertierra Spain :wink:

Would Navision’s team finally add all requests that people has been doing for years<< You must be dreaming, Alfonso :frowning: Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

Hello Marcus,Alfonso. Could not help smiling when a read your posting about the development enviroment in Navision. I got quick a shock coming from VB to Navision. I am still looking for so comments in the code and as for system documentation on the relationship between Tables and code units our Navision center in Sweden said their is none. Is this true? Regards Graham Spencer +46 8 764 74 25 Graham@cbs.se