Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/REPORT BUILDER/reports-examples/_order.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- repeatable-field-child-records
- resize
- signature
- sketches
- section
- modifying-the-widthheight-of-the-table
- timezone
Expand Down
60 changes: 60 additions & 0 deletions docs/REPORT BUILDER/reports-examples/sketches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Sketches
excerpt: ""
deprecated: false
hidden: false
metadata:
title: ""
description: ""
robots: noindex
next:
description: ""
---

## Display Sketches in Reports

In the BODY section, search for `element.isSketchElement`. If it doesn't exist, you can add it to your `RENDERVALUES` loop.

```javascript
<% } else if (element.isSketchElement) { %>
<div class="field">
<h2 class='field-label'><%= element.label %></h2>
<div class="field-value">
<% value && value.items.forEach((item, index) => { %>
<img class="sketch" src="<%= SKETCHURL(item.mediaID) %>" />
<% if (item.caption) { %>
<p><%= item.caption %></p>
<% } %> <% }); %>
</div>
</div>
<% } %>
```

## Resize Sketches

You can control the size of sketches in the STYLES section by targeting the `.sketch` class.

```css
.sketch {
max-width: 100%;
height: auto;
}
```

## Accessing a specific sketch by its field name

If you want to display the first sketch from a specific field:

```javascript
<div>
<%
// Using the data name of your sketch field
var sketchId = $my_sketch_field && $my_sketch_field[0] && $my_sketch_field[0].sketch_id;
%>
<% if (sketchId) { %>
<div class='sketch-column'>
<img class="sketch" src='<%= SKETCHURL(sketchId) %>' />
</div>
<% } %>
</div>
```
Loading