Using LIKE function in SQL Statement for Saved Search Formula

User wants to compare three Custom Item Fields to ensure that Custom Item Field #1 contains both Custom Item Field #2 and Custom Item Field #3.

In example:

Custom Item Field #1 Value = Sales, Purchase (internal ID = custitem_componentglaccts)

Custom Item Field # 2 Value = Sales (internal ID = custitem_customeglincome)

Custom Item Field # 3 Value = Purchase (internal ID = custitem_customeglexpense)

To do this, use the following formula as a basis for the Formula (Numeric) criteria. In this example, use Formula (Numeric) which returns the value 1 when Custom Item Field # 1 contains the values of Custom Item Field # 2 and Custom Item Field # 3. Otherwise, it will return the value of 0.

1. Navigate to Reports > Saved Searches > All Saved Searches > New

2. Click Item 

3. Click Criteria subtab

4. Click Standard sublist

5. Filter: Select Formula (Numeric)

Formula: case when {custitem_componentglaccts} like ‘%’|| {custitem_customeglincome}||’%’ and {custitem_componentglaccts} like ‘%’||{custitem_customeglexpense}||’%’ then 1 else 0 end

Formula (Numeric): Select equal to

Value: Enter 1

Click Set

6. Click Results subtab

7. Click Columns sublist

NoteYou can add other fields based on your requirements.

8. Search Title: Enter Title

Example: Items with same Custom Fields 2 and 3

9. Click Save and Run 

Leave a comment

Your email address will not be published. Required fields are marked *