Skip to main content
Inspiring
April 5, 2022
Answered

Document Generation: Tagger converting values

  • April 5, 2022
  • 1 reply
  • 780 views

Is there a way to convert a data value from what's in the incoming JSON to another value.  I've got a UI that has radio buttons on it.   The JSON submission looks like:

{

"exportUSA""1"
}
 
but I don't want to put the value of 1 into the document.  I want to convert it to Yes or No.   I didn't see anything in the Advance tab of the Document Generation Tagger.   Is there a way to do this?
 
 
    This topic has been closed for replies.
    Correct answer cfjedimaster

    Remember that the Tagger helps you design your document, but isn't actually used in a production application. You'll be using your Word template, your data, and calls to the API (normally via the SDK). 

    Before you call the API, you can manipulate your data as you see fit. So if you got that data above from a database, you would simply use code to change the 1 to Yes, and 0 to No. 

    In other words - get your data as you normally would - modify the data - call the API.

    1 reply

    cfjedimaster
    cfjedimasterCorrect answer
    Inspiring
    April 7, 2022

    Remember that the Tagger helps you design your document, but isn't actually used in a production application. You'll be using your Word template, your data, and calls to the API (normally via the SDK). 

    Before you call the API, you can manipulate your data as you see fit. So if you got that data above from a database, you would simply use code to change the 1 to Yes, and 0 to No. 

    In other words - get your data as you normally would - modify the data - call the API.

    Inspiring
    April 8, 2022

    I was hoping not to add a data manipulation step and instead handle it in the Word template, but fair enough.  Thanks for the response.

    Raymond Camden
    Community Manager
    Community Manager
    April 9, 2022

    One thing to keep in mind (and note, I'm cfjedimaster, I must have logged in with my nonwork user), is that template languages in general draw a line between how much can be done in the language and how much should be done in code. Handlebars, for example, is very strict. If I remember right, you can't do stuff like, "if name == ray" but must instead ensure you've got booleans setup ("if ray"). The idea being that Handlebars doesn't want you building complex templates. 

     

    This is all philosophical, but I thought I'd share. 🙂 I prefer Liquid which lets you do quite a bit, but even it has it's limits.