AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • In-Person Gatherings
    • Power BI Workshop
    • Podcast
    • Rolodex
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Acumatica Generic I...
Exclude Sales Order...
 
Notifications
Clear all

Questions Exclude Sales Orders where one line is a certain Inventory Item

 
Acumatica Generic Inquiries & Pivot Tables
Last Post by Royce Lithgo 4 years ago
5 Posts
2 Users
1 Reactions
1,649 Views
RSS
Kurt Keating
Posts: 27
 Kurt Keating
Topic starter
July 12, 2022 6:09 pm
(@kkeating)
Trusted Member
Joined: 4 years ago

Hello,
I have a GI where I need to include certain Sales Orders AND exclude orders in that subset where they have 1 particular NONSTOCK inventory item "COLOFEE"

Hoping someone can help with the funky GI conditions functions:

image
image

 

I can do this in sql using the Having clause:

Select c.OrderNbr
from soorder C, Soline A, Inventoryitem B
where c.OrderNbr=a.OrderNbr
and A.inventoryid=B.inventoryid
and B.inventorycd = 'colofee'
group by C.OrderNbr
having sum(case when b.inventoryCd = 'colofee' then 1 else 0 end) = 0

help is appreciated!

k2


4 Replies
Royce Lithgo
Posts: 557
 Royce Lithgo
July 12, 2022 11:34 pm
(@roycelithgo)
Honorable Member
Joined: 6 years ago

Try Left Joining an additional SOLine and use it to filter your main query.

Join on ordertype, ordernbr and filter where inventorycd=colofee.

Add another filter SOLine2.OrderNbr is empty.

This will only return rows where there's no match against an order that has a row with colofee.

You might have a problem if an order has the COLOFEE item twice, as it will duplicate the rows in the main query.


Reply
Kurt Keating
 Kurt Keating
(@kkeating)
Joined: 4 years ago

Trusted Member
Posts: 27
July 13, 2022 12:40 pm
Reply toRoyce LithgoRoyce Lithgo

@roycelithgo ok, i think i followed your comments but i'm sure i missed something, as the query doesn't return any rows now, even when I have a matching SO:

image
image
image

Reply
Royce Lithgo
Posts: 557
 Royce Lithgo
July 13, 2022 5:09 pm
(@roycelithgo)
Honorable Member
Joined: 6 years ago

You have the COLOFEE filter on the wrong table (needs to be SOLine2). And you'll also need to join InventoryItem to SOLine2 to apply the filter on InventoryCD. You might need a 2nd join of InventoryItem depending on how you're using it in the Results.


Reply
Royce Lithgo
Posts: 557
 Royce Lithgo
July 13, 2022 9:17 pm
(@roycelithgo)
Honorable Member
Joined: 6 years ago

Got it working - give this a go.

Note that the data is returning at line level so if you want it at order level it needs Group criteria (as mine has).

xx Filter SOLine.xml

 


Reply
Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,530 Topics
  • 11 K Posts
  • 25 Online
  • 2,418 Members
Our newest member: Chad Treadwell
Latest Post: Negative/Credit Inventory Value?
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2026 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×