My tag is not being replaced with a value

There are two main reasons for this:

You are not assigning the tag in your program

Sometimes, when modifying legacy code to work with BP Forms, you will follow the print statements in the code and replace those with calls to bpi.tagval2().  However, sometimes legacy code, a print directive may exist within an if-then or if-else or case structure which can result in your call to bpi.tagval2() only being called when that condition evaluations to true.   To avoid this situation, it is a good practice to initialize tags to null in an initialization subroutine called at the start of the program.  If the tags are assigned to null prior to the main body of the logic being executed, then if an assignment of that tag to a specific value is contained within conditional logic, it will not matter since the initialization routine will have already assigned these tags to null and therefore, the tags will exist with an assigned value regardless of whether the assignment within the legacy code is within conditional logic or not.

The tag within the template contains formatting markup

You may find that your tag name appears in your template and that you are certain that you have assigned it a value in your host program and let it still the tag remains in the final document rather than being replace with its assigned value.  This can happen if you have inadvertently injected market into the tag.



In this example, you'll observe that the letters %my are in red while the TagName% ending is in black.   For the system to be able to understand that the first part is red and the last part is black, it must place special markup within the string %myTagName% when it stores the tag within the document.

To explain, it might internally store the above with markup like this:


So then, the tag %myTagName% does not really exist because the markup being used has changed the tag name to something other than what is visible in the template.   Without the tag name being one coherent, unbroken piece of text, the routine while replaces tags with values would be prevented from finding the tag and replacing it with the proper value.

To remedy

To remedy this situation, you may edit the template and verify that the tag contains no hidden markup by following this procedure:

  • Triple click to select the entire tag
  • From the Open Office / Libre Office menumenu, choose Format > Clear Direct Formatting
  • Now, triple click to select the entiire tag
  • With the entire tag selected, you may apply justification, color, font, font-size etc. to the entire tag

By Applying the formatting to the entiire tag, rather than to a part of the tag, you will ensure that the entire tag string is preserved as one, coherent, unbroken text string and this should allow the tag to function as expected.