i want to write an sql query in an item saved sear...
# ask-stanley-ai
n
i want to write an sql query in an item saved search in the results tab so that the column shows the summation of the quantity available at a certain location chosen by a filter
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems you want to display the sum of the quantity available at a certain location in a single line in an item saved search. You can achieve this by using a formula in the results tab of your saved search. Here is a sample formula that you can use:
Copy code
CASE WHEN {location} = {item.inventorylocation} THEN {item.locationquantityonhand} else 0 END
This formula checks if the location of the item matches the location filter. If it does, it returns the quantity on hand for that location. If it doesn't, it returns 0. You can modify this formula to suit your needs. For example, you can replace
{location}
and
{item.inventorylocation}
with the actual location IDs or names that you are interested in. In your search criteria, you might want to include: - Item: Type = Is Any Of - Inventory Item, Assembly/Bill of Materials, Kit/Package - Location = Is Not - unassigned - - Item: Inactive = Is False Remember to use 'Item Fields' as the Filter for Item. ****** 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.863841891
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855883896
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855254173
Please provide your feedback on this answer.