5by5
12/7/2005 8:19:00 PM
Thanks for highlighting this class. This should do.
Since I am a newbie, could I ask where is this class documented? I've
searched through MSDN and all the Axapta/Morphx help files, and there seems
to be spotty references to DictTable, but no authoritative reference. For
example, if I wanted to know what other parameters besides fieldCnt are
available on a dictTable.Call, where might I find it?
Would you know where I should be looking? I'm even having a fun time trying
to find this in the AOT.
"Luegisdorf" wrote:
> Hi 5by5
>
> You can use the DictTable classes to iterate all fields of your specified
> table. It have to look like this:
>
> dictTable = axapta.CreateObject("DictTable", 77)
> For i = 1 To i <= dictTable.Call("fieldCnt") Step 1
>
> MessageBox.Show(CustTableBuffer.field(dictTable.Call("fieldCnt2Id")))
> ' think property field from recordBuffer should work with
> fieldId ...
> Next
>
> Hope this works, if not - please respond.
>
> Best regards
> Patrick
>
>
> "5by5" wrote:
>
> > I want to loop through all the fields in the IAxaptaRecord, e.g., something
> > like:
> >
> > for i = 1 to IAxaptaRecord.method_to_return_number_of_fields()
> > fieldName = IAxaptaRecord.method_to_return_Nth_fieldName(i)
> > fieldValue = IAxaptaRecord.field(fieldName)
> > next
> >
> > Being new to Axapta, are there methods that give me the number of fields or
> > the field name(s) in the above pseudocode?
> >
> > Currently I am using explicit field names in the skeleton code from the VB
> > .NET to Axapta examples, as below.
> >
> > Dim AxaptaQuery As AxaptaCOMConnector.IAxaptaObject
> >
> > Dim AxaptaQueryRun As AxaptaCOMConnector.IAxaptaObject
> >
> > Dim AxaptaDataSource As AxaptaCOMConnector.IAxaptaObject
> >
> > Dim AxaptaRange As AxaptaCOMConnector.IAxaptaObject
> >
> > Dim CustTableBuffer As AxaptaCOMConnector.IAxaptaRecord
> >
> >
> > ' Find these with dict classes
> >
> > CustTable = 77
> >
> > CustTable_Name = 2
> >
> >
> >
> > AxaptaQuery = Axapta.CreateObject("Query")
> >
> > AxaptaDataSource = AxaptaQuery.Call("AddDataSource", CustTable)
> >
> > AxaptaRange = AxaptaDataSource.Call("AddRange", CustTable_Name)
> >
> >
> >
> > ' Fill in the range from the range control
> >
> > AxaptaRange.Call("Value", sRange)
> >
> >
> >
> > AxaptaQueryRun = Axapta.CreateObject("QueryRun", AxaptaQuery)
> >
> > i = 0
> >
> > While (AxaptaQueryRun.Call("Next"))
> >
> > CustTableBuffer = AxaptaQueryRun.Call("GetNo", 1)
> >
> > currentCustomerRecord.AccountNum =
> > CustTableBuffer.field("AccountNum")
> >
> > currentCustomerRecord.Name = CustTableBuffer.field("Name")
> >
> > currentCustomerRecord.Address = CustTableBuffer.field("Address")
> >
> > currentCustomerRecord.Phone = CustTableBuffer.field("Phone")
> >
> > currentCustomerRecord.Telefax = CustTableBuffer.field("Telefax")
> >
> > i = i + 1
> >
> > End While