Hello,
Is there any way to get the query object from view object?
(i.e get the query that represented the query behind the view: DirPartyPostalAddressView)
Thanks :)
Hello,
Is there any way to get the query object from view object?
(i.e get the query that represented the query behind the view: DirPartyPostalAddressView)
Thanks :)
For query - I figure out how, so I succeeded getting the query object, but when the case is on 'data sources' - I I presume I must add the datasource in code, so need to loop over all the data sources elements properties.
I didn't see any properties iterator so I can loop through.
Thanks :)
When you know the query name, you can pass it to the constructor of the Query class (new Query('xyz')). Sorry, I thought you already knew that.
Still don't understand how create an object instance from the current treeNode as my original post.
AOTnextSibling() is the right syntax for getting the next sibling. If you want to get something else, use another method. For example, if you want to get the first child, call AOTfirstChild(). It isn't that complicated. :-)
Thank you.
That's what I am looking for.
I have a code like this:
TreeNode treeNode; #AOT str s; treeNode = treeNode::findNode(#ViewsPath + '\\' + tablestr(DirPartyPostalAddressView) + '\\MetaData'); while (treeNode) { s = treeNode.treeNodeName(); switch(s) { case 'data sources': // need to get the object break; default: // need to get the object break; } treeNode = treeNode.AOTnextSibling(); }
I presume AOTnextSibling is not the right syntax (I am not looping through the LogisticsPostalAddress object).
I need to get the object that is behind LogisticsPostalAddress or data sources object.
Thanks :)
Use the TreeNode API to analyze the view definition.
Do you have database access on your enviroment?
For me the simplest method has allways been to look the view up in ssms.
If there is a easier way I would shure like to know.
Your view btw:
CREATE VIEW [dbo].[DIRPARTYPOSTALADDRESSVIEW] AS SELECT T1.PARTY AS PARTY,T1.RECID AS PARTYLOCATION,T1.ISPRIMARY AS ISPRIMARY,T1.ISLOCATIONOWNER AS ISLOCATIONOWNER,T1.ISPRIMARYTAXREGISTRATION AS ISPRIMARYTAXREGISTRATION,T1.PARTITION AS PARTITION,T1.RECID AS RECID,T2.PARTITION AS PARTITION#2,T2.LOCATIONNAME AS LOCATIONNAME,T2.ADDRESS AS ADDRESS,T2.STREETNUMBER AS STREETNUMBER,T2.STREET AS STREET,T2.CITY AS CITY,T2.ZIPCODE AS ZIPCODE,T2.STATE AS STATE,T2.COUNTY AS COUNTY,T2.COUNTRYREGIONID AS COUNTRYREGIONID,T2.DISTRICT AS DISTRICT,T2.POSTBOX AS POSTBOX,T2.BUILDINGCOMPLIMENT AS BUILDINGCOMPLIMENT,T2.TIMEZONE AS TIMEZONE,T2.LONGITUDE AS LONGITUDE,T2.LATITUDE AS LATITUDE,T2.LOCATION AS LOCATION,T2.VALIDFROM AS VALIDFROM,T2.VALIDTO AS VALIDTO,T2.COUNTRYCURRENCYCODE AS COUNTRYCURRENCYCODE,T2.ISPRIVATE AS ISPRIVATE,T2.DISTRICTNAME AS DISTRICTNAME,T2.POSTALADDRESS AS POSTALADDRESS,T2.ISOCODE AS ISOCODE,T2.STREETID_RU AS STREETID_RU,T2.HOUSEID_RU AS HOUSEID_RU,T2.FLATID_RU AS FLATID_RU,T2.BUILDING_RU AS BUILDING_RU,T2.APARTMENT_RU AS APARTMENT_RU,T2.PRIVATEFORPARTY AS PRIVATEFORPARTY,T2.XRECID_LOGISTICSPOSTALADDRESS AS XRECID_LOGISTICSPOSTALADDRESS,T2.XRECVERSION_LOGISTICSPOSTALADDRESS AS XRECVERSION_LOGISTICSPOSTALADDRESS,T2.CITYRECID AS CITYRECID FROM DIRPARTYLOCATION T1 LEFT OUTER JOIN LOGISTICSPOSTALADDRESSVIEW T2 ON (T1.LOCATION=T2.LOCATION AND (T1.PARTITION = T2.PARTITION)) WHERE (T1.ISPOSTALADDRESS=1)
GO
The view is built in AX AOT.
I need some X++ code to figure out what are the objects behinds the DirPartyPostalAddressView object (it is a view, but also an object in AOT), and I can go on from that point.
I see that there is a query object (not all the views), so I need to get that object.
Thanks :)
You can analyze the view definition in AOT. The actual view in SQL Server obviously doesn't know anything about any query in Dynamics AX.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,246 Super User 2024 Season 2
Martin Dráb 228,041 Super User 2024 Season 2
nmaenpaa 101,148