two saved searches have the exact same criteria bu...
# ask-stanley-ai
q
two saved searches have the exact same criteria but different results
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** If two saved searches have the exact same criteria but are returning different results, there could be several reasons for this: 1. Access Level: The user running the searches may have different access levels, which can affect the results of the search. Make sure the user has the necessary permissions to access all the data that the search is supposed to return. 2. Search Type: The type of search (standard or summary) can also affect the results. Summary searches aggregate data, which can lead to different results if the other search is a standard search. 3. Filters: Even if the criteria are the same, the filters applied to the search can be different, leading to different results. Check the filters applied to both searches. 4. Formulas: If there are formulas used in the search, they could be causing the discrepancy. Check any formulas used in the search criteria or results. 5. Join Fields: If the search is using join fields, the join could be set up differently in the two searches, leading to different results. 6. Sorting: The sort order of the results can also affect the output, especially if you're only looking at a subset of the results. Here are some code examples from the threads on how to manipulate saved searches: To load and update the criteria of a saved search:
Copy code
javascript
let searchB = search.load({id: 'B'});
let bDefaultFitlers = searchB.filters;
bDefaultFitlers.push("AND", ["fieldId", "anyof", "valueFromA"]);
searchB.run().each(result => {/*do something*/});
To run both searches, create objects from the results, then use the value of one search to pull back the value of the other:
Copy code
javascript
let searchAResults = {fieldToFilterOn: 1234}
let searchBResults = {1234: 'valueYouWant', 5678: 'otherValue'}
let resultYouWant = searchBResults[searchAResults.fieldToFilterOn]
Remember to thoroughly check all aspects of your saved searches to ensure they are set up correctly and as expected.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830810606
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827758789
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827514529
Please provide your feedback on this answer.