How to reference specific array items in Saved Sea...
# ask-stanley-ai
j
How to reference specific array items in Saved Search Results Filter?
c
AI generated answer (using internal Slack threads):
To reference specific array items in Saved Search Results Filter, you can use the
IN
condition in a formula text field. This allows you to check if a specific field's value is included in the array of values you provide. Here is an example of how you can use it:
Copy code
CASE WHEN {hntbFieldId} IN ('22033', '22034', '22035', '22036') THEN 'T' ELSE 'F' END
In this example,
{hntbFieldId}
is the field you want to check. The values '22033', '22034', '22035', '22036' are the array items you want to reference. If the field's value is in the array, the formula returns 'T'. Otherwise, it returns 'F'. If you are dealing with a text field, you can create separate filters for each array item and use the
OR
operator to combine them. Alternatively, you can use a formula that uses the
IN
condition. For example, if you want to filter a search based on an array of values in a text field, you can create a search like this:
Copy code
javascript
var lineItemSearch = search.create({
            type: 'transaction',
            filters: [
              ['custcol_sf_order_line_id', 'is', [
                "802Am000000jGt6IAE",
                "802Am000000jGt7IAE"
             ]]
            ],
            columns: [
              search.createColumn({
                name: 'custcol_sf_order_line_id',
                summary: 'GROUP'
              }),
              search.createColumn({
                name: 'amount',
                summary: 'SUM'
              })
            ]
          });
In this example,
custcol_sf_order_line_id
is the text field you want to filter. The values "802Am000000jGt6IAE" and "802Am000000jGt7IAE" are the array items you want to reference. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820506573
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816376686
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816257536
Please provide your feedback on this answer.
Thank you for your feedback