> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/advanced-template-logic/template-attributes/template-attributes-how-to-guides/how-to-display-different-values-based-on-conditions.md).

# How To: Display Different Values Based on Conditions

Use `render` when each row needs different output based on its own field values.

### Problem

You need to show different content in table cells based on field values.

### Solution

**Basic Conditional Rendering:**

```
<!--{{!
<lineitemsSOQL>
<soql>SELECT Title, Status__c FROM Contact WHERE AccountId = '{{!Account.Id}}'</soql>
<column render="RECORD.Title==null,No Title Available,RECORD.Title"></column>
</lineitemsSOQL>
}}-->
```

**Multiple Conditions:**

```
<column render="RECORD.Status__c == 'Active',✓ Active,RECORD.Status__c == 'Inactive',✗ Inactive,Unknown"></column>
```

**With Formatting:**

```
<column type="rtf" render="RECORD.StageName == 'Closed Won',lt#span style='color:green;'gt#✓ Won lt#/spangt#,RECORD.StageName == 'Closed Lost',lt#span style='color:red;'gt#✗ Lost lt#/spangt#,In Progress"></column>
```

**Result:** Won records show in green, lost records show in red, and other records show `In Progress`.

**Nested Conditions:**

```
<column render="RECORD.Country__c == 'USA',[RENDER1]RECORD.State__c == 'CA',California Rate,[RENDER2]RECORD.State__c == 'NY',New York Rate,[ENDRENDER2][ENDRENDER1],International Rate"></column>
```

### Important Notes

* This works only with `<lineitemsSOQL>`.
* Include every rendered field in the SOQL query.
* Do not place a field name between `<column></column>` tags.
* Use `RECORD.FieldName` for the current row.
* Escape HTML tags with `lt#` for `<` and `gt#` for `>`.

### Pattern Matching

**STARTSWITH:**

```
<column render="RECORD.Product_Name__c STARTSWITH 'Pro',Professional Edition,Standard Edition"></column>
```

**ENDSWITH:**

```
<column render="RECORD.Email__c ENDSWITH '@company.com',Internal,External"></column>
```

**CONTAINS:** Use `replaceall` with regex when you need contains-style matching.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/template-attributes/template-attributes-how-to-guides/how-to-display-different-values-based-on-conditions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
