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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Encodian - Line Spacin...
Power Automate
Unanswered

Encodian - Line Spacing when variables empty

(0) ShareShare
ReportReport
Posted on by 55

I am creating a word document using encodian and need a way to add line breaks to the json that goes to encodian.

 

I have the following in a word doc

 

 

 

SECTION ABOVE END

<<[SUBPROCESSORSTITLE]>>
<<[SUBPROCESSORPREAMBLE]>>

<<[SUBPROCESSOR1]>><<[DATASENT1]>>
<<[PROCESSING1]>>

<<[SUBPROCESSOR2]>><<[DATASENT2]>>
<<[PROCESSING2]>>

NEXT SECTION START

 

 

 

If none of these variables have any content, they are not merged in but the spacing that i have placed between them is.

 

That means that if this section is blank between the end of the last section and the start of the next i have 4 blank line breaks which makes the document look weird.

 

I have condensed the word doc so that i looks like this

 

 

 

SECTION ABOVE END
<<[SUBPROCESSORSTITLE]>>
<<[SUBPROCESSORPREAMBLE]>>
<<[SUBPROCESSOR1]>><<[DATASENT1]>>
<<[PROCESSING1]>>
<<[SUBPROCESSOR2]>><<[DATASENT2]>>
<<[PROCESSING2]>>
START OF NEW SECTION

 

 

and updated the encodian JSON in power automate to look like this with <br> tags to handle the line breaks - some of the passed in variables also have <br> in them.

 

Screenshot 2023-07-18 at 14.55.56.png

The issue that i now have is that i am getting the following encodian error.

 

{"HttpStatusCode":400,"HttpStatusMessage":"Bad request","OperationId":"a8c5ae4f-8738-4512-9bb5-e35361c2442c\\1","Errors":["A error occurred parsing the JSON document provided: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 2, position 12."],"OperationStatus":"Error"}

 

The Raw Input into encodian is as follows:

 

 

 

{
"EVENTNAME": "Event Name Test",
"NOWDATE": "18 July 2023",
"CLIENTNAME": "Tennis",
"SUBPROCESSOR1": " SUbby 1 Company",
"PROCESSING1": "INFO",
"DATASENT1": " - Name, Address, Phone Number",
"SPECIALDATATITLE": "",
"SPECIALDATABLURB": "",
"SUBPROCESSORSTITLE": "<br>Sub Processors<br><br>",
"SUBPROCESSORPREAMBLE": "We have some more data here.<br><br>",
"SUBPROCESSOR2": "<br><br>",
"PROCESSING2": "",
"DATASENT2": " - <br><br>"}

 

 

Does anyone know how i fix my issue?

Categories:
I have the same question (0)
  • AdamHewitt Profile Picture
    55 on at
    Re: Encodian - Line Spacing when variables empty

    I think i might need to take all of the blame here for the error - missing "{" at the start of the JSON.

     

    However, when the word document is populated it shows the <br> as text rather than starting a new line - is there a way around this?

  • Verified answer
    AdamHewitt Profile Picture
    55 on at
    Re: Encodian - Line Spacing when variables empty

    It also seems like a rudimentary way of fixing this issue is to cramp the word doc up like I have and create a variable like the image below that acts as your spaces.  I have used conditions to set the variable based on whether the other variables around it exist.

     

    This is a space then a hyphen then a space

    Screenshot 2023-07-18 at 16.32.53.png

  • AdamHewitt Profile Picture
    55 on at
    Re: Encodian - Line Spacing when variables empty

    Thats really useful information, i didnt know that was possible.

     

    The only issue that you get with word is styling the text.  I am using title styles and body styles which are very difficult to add to one big chunk of text.  I have tried using style breaks but they dont seem to work.

  • AdamHewitt Profile Picture
    55 on at
    Re: Encodian - Line Spacing when variables empty

    I am getting an issue with this.

     

    <<if[SUBPROCESSOR1]= Error! Character '=' is unexpected. =””]>><<else>><<[SUBPROCESSORSTITLE]>><<[ControlChar.LineBreak]>><</if

    >>

     

    My original code in word is

     

    <<if[SUBPROCESSOR1]==””]>><<else>><<[SUBPROCESSORSTITLE]>><<[ControlChar.LineBreak]>><</if

    >>

  • AdamHewitt Profile Picture
    55 on at
    Re: Encodian - Line Spacing when variables empty

    Got it working, some of the advanced settings needed to be chaged.  Thanks so much for your help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard