• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Variables passed to docx should be accessible everywhere and repeatedly?

Explorer ,
Jun 04, 2022 Jun 04, 2022

Copy link to clipboard

Copied

Finding some strange behavior which I can't explain. I am not super facile with node.js but assume when a variable is passed, it is accessible anywhere and repeatedly. Please correct me if I am wrong.

 

On a page of the docx, I am calling a variable which doesn't return anything...

 

# example
On a scale of 0-100, the document’s sentiment score is: {{ sentiment }}

 

However, if I repeat it elsewhere it renders...

 

# test area at the bottom of the doc
Test section
sentiment: 98 <-- this is the {{ sentiment }} variable repeated

 

# here is a snippet of the sampleData passed to the doc

const sampleData = {
<snip>
"sentiment": sentiment,
</snip>
};

 

# and here is a console.log of the correct sampleData
INFO sampleData--> { sentiment: 98}

 

I thought it was related to upgrading to @adobe/pdfservices-node-sdk 2.2.2 but I rolled back to 2.2.0 and the behavior still exists. In previous months, calling variables was rock solid and I got exactly what I expected.

 

Thanks in advance.

 

 

TOPICS
Document Generation API , How to , PDF Services API

Views

200

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

Are the fields within different contexts within the Word document like one is at the document level, one is in a table or conditional section etc? Can you share the Word file + the JSON?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

That's the puzzling part; it's a simple variable taken from a dbase further upstream and passed in to a single field. 

 

I will try to rip out the other code (I have ~10 variables used correctly), slim down and post.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

Oddly, if I repeat the line, one right after the other, the first does not work but the second does.  For now as a shim, I'm 'whiting out' the first line.  Back soon.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

LATEST

Very odd. Are you sure the curly brackets are being opened and closed as pairs?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources