The UniqueOcc (from unique occurrence) is a command-line tool that parses the output of the FINDSTR tool that we normally use to search XPO files contents (specially files in the Dynamics AX version control repositories, such as Source Depot).
The FINDSTR is really usefull for searching an entire directory and its subdirectories for XPO files containing specific words. For example, if you want to know which classes, forms, tables, etc. use the Legal Text feature, you would get a fair estimated by running:
C:\Depot\AX\Source\Application\GLS>findstr /i /s "legaltxt" *.xpo
This command will search all XPO files (*.xpo) for the “legaltxt” string, starting in the GLS directory, including all subdirectories (/s) and using an insensitive case (/i) comparison.
The classical FINDSTR output would be:
Classes\NFFiscalDoc_BR.xpo: # FiscalDocJourLegalTxt_BR ...
Classes\NFFiscalDoc_BR.xpo: # FiscalDocTransLegalTxt_BR ...
Classes\NFFiscalDoc_BR.xpo: SOURCE #postLegalTxt
Classes\NFFiscalDoc_BR.xpo: #protected void postLegalTxt()
Classes\NFFiscalDoc_BR.xpo: # this.postFiscalDocJourLegalTxt();
Classes\NFFiscalDoc_BR.xpo: # this.postFiscalDocTransLeg...
Classes\NFFiscalDoc_BR.xpo: # nfFiscalDoc.postLegalTxt();
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: SOURCE #getCFOPLegalTxt
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: #protected LegalTxt_BR ins...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: # LegalTxt_BR local...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: # localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: # localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: # localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo: # return localLegalTxts
(...many, many, many more lines...)
To avoid scrolling and filter it a lot to find which artefacts do have the string you are looking for, you can use the ‘/m’ switch, which will output:
Classes\NFFiscalDoc_BR.xpo
Classes\NFFiscalDoc_DeliverySlip_BR.xpo
Classes\PurchCopying.xpo
Classes\PurchFormLetter.xpo
Classes\PurchFormLetter_Invoice.xpo
Classes\SalesCopying.xpo
Classes\SalesFormLetter.xpo
Classes\SalesFormLetter_Invoice.xpo
Data Dictionary\Base Enums\LegalTxtSection_BR.xpo
Data Dictionary\Extended Data Types\LegalTxtDescription_BR.xpo
Data Dictionary\Extended Data Types\LegalTxtId_BR.xpo
(...)
For those curious C++ programmers, the ‘/m’ switch is equivalent to:
Continue reading →