PS Query & SQL

 View Only
  • 1.  Expression Help!

    Posted 3 hours ago

    Hello Friends!

    Can I please get some expert help to write an expression for PS Query (Not SQL) for the following SQL that looks at ITEM_LINE_SF where field PAYMENT_ID_NBR appears more than once, drop all rows with that PAYMENT_ID_NBR. The goal is to not show the credit and reversal on the account within a 3rd party system. Delivered in PS this already happens.



    ------------------------------
    Lidia Anderson
    Manager, Campus Solutions
    Central Washington University
    lidia.anderson@cwu.edu
    ------------------------------
    Alliance 2026 Recordings are here!


  • 2.  RE: Expression Help!

    Posted an hour ago
    Hi Lidia,

    Is it true for you all that you will only have multiple PAYMENT_ID_NBRs in the case of credits reversals? I think we are set-up in such a way that we can have several payment IDs for a variety of reasons - although this is a bit outside of my wheelhouse.

    From a Query Manager perspective, to remove any instance of multiple PAYMENT_ID_NBRs I wonder if you can just get away with creating a COUNT() expression, and setting HAVING criteria against it:

    image.png
    1. Write the expression (make sure the Aggregate Function box is checked). 

    You might want to leave the "Distinct" part of the expression out, but I think you will want to use it. I would suggest trying it both ways because it will likely make a big difference.

    2. Return the count as a field. This is important because it creates "Group By" logic in the SQL, that tells the query how to partition the Count.

    3. Add The criteria, setting the expression to be "not greater than" 1:

    image.png

    If you run the query, it should drop all instances where there is more than 1 PAYMENT_ID_NBR.

    You will not find the criteria in the "Criteria" tab, but instead it will exist on the "Having" tab - where aggregate filtering sits.

    Let me know if you want to talk through it a bit more. :)

    Jeffrie
    --
    Jeffrie Brooks | BUSINESS SYSTEM ANALYST
    UNIVERSITY OF MICHIGAN | INFORMATION AND TECHNOLOGY SERVICES
    734-647-8763 | jedobr@umich.edu



    Alliance 2026 Recordings are here!