Conditionally show text not value

I am using Plumsail Documents to generate Purchase Orders to our Vendors.

We have a vendor that we are having issues understanding we want them to ship the items to us, even though we do not know the price of teh shipping. So, what I want to do is includin a "Shipping" item in my list of Items on the PO. But since I don't have a price, in the Unit Price and Total Price fields, I want to put the text "TBD". So it would render like this:

Item             Quantity         Unit Price       Total Price     
Widget                 50              $1,000         $50,000
Shipping.                1                TBD             TBD

In the Document I currently have the following formatters:

{{Details.Unit}}	{{Details.UnitPrice}:format(C2)}	{{Details.TotalPrice}:format(C2)}

How do I do something like "if -1 then 'TBD' else use value formatters"?

(Note: I tries to change the JSON before I submit it, but my code chokes on it because I am mixing strings and numbers in the same field.

Hi @sphilson,

You can use the map formatter to change the value of a token under certain conditions.

Here's an example of how it can be used in your case:

{{Details.Unit}}	{{Details.UnitPrice}:map("-1" = "TBD"):format(C2)}	{{Details.TotalPrice}:map("-1" = "TBD"):format(C2)}

The value will be automatically changed to TBD if the price is -1.