---
title: "How to avoid format errors when using output=wiki"
canonical: "https://support.appfire.com/space/SUPPORT/89137650/How%20to%20avoid%20format%20errors%20when%20using%20output%3Dwiki"
format: markdown
---
## <span style="color: #000000">Summary</span>

<span style="color: #000000">If you use </span>**<span style="color: #000000">output=wiki</span>**<span style="color: #000000">, the table is produced using wiki table notation. Data found within the table may contain wiki text that may interfere with the formatting of the table.</span>

## <span style="color: #000000">Solution</span>

<span style="color: #000000">Such values either need to be escaped or surrounded by constructs that prevent this. Modify your SQL statement to do this.</span>

## <span style="color: #000000">Examples</span>

- <span style="color: #000000">Use a panel </span>

```
'{panel:borderStyle=none|bgColor=#ffffff} ' || myfield || ' {panel}'
```

- <span style="color: #000000">Use a div - needs the</span> [Adaptivist Content Formatting app](https://www.adaptavist.com/display/Plugins/Content+Formatting)

```
'{div:style=left:1em;right:1em} ' || myfield || ' {div}'
```

<span style="color: #000000">Better Solution</span>

<span style="color: #000000">If you have administration access to your database, it makes it a lot more convenient for your users to create a few convenience functions in your database to do this automatically.</span>

##### **confluence_text function for PostgreSQL**

```
-- Function: confluence_text(text)
-- DROP FUNCTION confluence_text(text);
CREATE OR REPLACE FUNCTION confluence_text(text)
  RETURNS text AS
$BODY$ select '{div:style=left:1em;right:1em} ' || $1 || ' {div}' $BODY$
  LANGUAGE 'sql' STABLE
  COST 100;
ALTER FUNCTION confluence_text(text) OWNER TO postgres;
COMMENT ON FUNCTION confluence_text(text) IS 'Confluence - wrap text in a div to protect against table format errors';

```

##### **confluence_panel function for PostgreSQL**

```
-- Function: confluence_panel(text)
-- DROP FUNCTION confluence_panel(text);
CREATE OR REPLACE FUNCTION confluence_panel(text)
  RETURNS text AS
$BODY$ select '{panel:borderStyle=none|bgColor=#ffffff} ' || $1 || ' {panel}' $BODY$
  LANGUAGE 'sql' STABLE
  COST 100;
ALTER FUNCTION confluence_panel(text) OWNER TO postgres;
COMMENT ON FUNCTION confluence_panel(text) IS 'Confluence - wrap a panel around a string';

```

<span style="color: #000000">Then, the examples above are much easier:</span>

<span style="color: #000000">*confluence_panel(myfield)*</span>

<span style="color: #000000">*confluence_text(myfield)*</span>