web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :

D365FO Searching Code Part 2

DaxNigel Profile Picture DaxNigel 2,574

Previously I have provided some code showing how you can search the entire code base for a word. This is useful when the work is fairly unique, as a label name/number. When you are trying to find something specific you need to reduce the noise and get a more filtered response.

Today I am trying to review all the tables that use the InventDimId field. There are two things that need to be checked:

1. The list of the extended data type is related to the InventDimId need to be determined. This means we need a list of the EDT’s which extend InventDimId and include inventdimid. This can be done using the search code

PS C:\Users\Admindef1d1a223> cd "K:\AOSService\PackagesLocalDirectory"
Get-ChildItem .\* -Recurse -Include *.xml | Select-String -Pattern "<Extends>InventDimId</Extends>" | Set-Content -Path "$home\Desktop\SearchResult_Extends.txt"

The key control to the above code is the search string “<Extends>…</Extends>” This will return only the objects that extend that EDT, which for an EDT reference would be other EDT’s.

2. Using the list of extended data types generated in part 1, and including the inventidmid a new search needs to be completed looking for the database fields that use the EDT

cd "K:\AOSService\PackagesLocalDirectory"
Get-ChildItem .\* -Recurse -Include *.xml | Select-String -Pattern "<ExtendedDataType>InventDimId</ExtendedDataType>" | Set-Content -Path "$home\Desktop\SearchResult.txt"

The key control to the above code is the search string “<ExtendedDataType>…</ ExtendedDataType >” This will return only the objects that use the EDT, which should only be database fields.

Note: This takes sometime to complete, there is a lot of code to scan through. You could try limiting the directories you are scanning to be only th eobjects you are interested. I might look into this in the future, if I get any time!


This was originally posted here.

Comments

*This post is locked for comments