Electronic reporter: New line in a word template content control

Anyone who had used Electronic Reporter especially for precision design work will know that there are many frustrating challenges that one encounters on a day by day basis. One of these that recently got me stuck for a while was using a new line character in a content control.

Scenario: I had a word table with a selection of content controls across various cells. In the first cell however i had 2 content controls of which one of them was optional based on the data filled in. The idea was that there shouldn’t be a blank space or line after the first control if there isnt data in the second field. E.G.

If the data for the second control is present then it needs to appear below the first value E.G.

The easiest solution would obviously be to include a new line between the content controls E.G.

However this would result in a permanent line regardless of whether the second content control has a value which is not ideal.

The second option would be to include a CHAR(10) in the data being passed to the second content control from electronic reporter E.G. IF(@.SubValue <> “”, CHAR(10) & @SubValue, “”). However this did not work off the bat for me as there are two additional changes that needed to happen as well.

  1. On the table in word the “Wrap text” option must be selected
  1. On the content control in word, the “Allow carriage returns (multiple paragraphs)” option but me checked as well

The second step was the most obscure to me as many websites have pointed to the first step but never mentioned the second. I hope this will help someone in the future.

Powershell/GIT – Create PackageLocalDirectory Symlinks

Its been a while since my last post, but to follow are hopefully a couple of my mental notes I need to put down into writing for future use.

Recently i had to connect a development environment to a GIT repository. I followed the following guide:

https://devblogs.microsoft.com/cse/2022/06/14/xpp-and-git/

However due to a large number of different models in the repo, it wouldve taken quite a while to create each and every folder link, so i wrote the following (draft) script. To run it, navigate to the C:\AOSService\PackagesLocalDirectory in Powershell and run the following:

Get-ChildItem –Path "C:\users\Administrator\source\repos\[FOLDER WITH MODEL FOLDERS]\"  -Directory |
Foreach-Object {    
    New-Item -ItemType SymbolicLink -Path $_.BaseName -Target $_.FullName

    Write-Host $_.BaseName

}

Note 1: This script is not bulletproof and I’m do not claim in anyway to be a Powershell expert, so if you have improvements let me know, I’d love to learn.

Note 2: I in addition to the post above, I needed to fix securities on the folders in my repo to allow the AOS service to read the models as i was receiving these errors:

AX is shutting down due to an error.
An error occurred when starting the AOS.
Exception details:
Microsoft.Dynamics.AX.InitializationException: An error occurred when starting the AOS. ---> System.UnauthorizedAccessException: Access to the path 'C:\AOSService\PackagesLocalDirectory\[MODEL FOLDER]' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)