# 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: 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:

```
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>
```

The question should be specific, self-contained, and written in natural language.
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.
