Forum Discussion

lParker755's avatar
lParker755
Copper Contributor
Feb 02, 2023

Run Query and List Results operation

I am using the Run Query and List Results operation within Logic Apps to get an Incident Name.  The issue I have is it seems to be duplicating the results in the list i.e Incident Name appears twice.  Is there some setting I'm missing or is there a concise way to strip the second value away?  

  • lParker755 

     

    if the query is returning duplicate values for the Incident Name, one possible solution is to add a "distinct" operator to the query to ensure that only unique values are returned

     

    SecurityIncidents
    | where IncidentNumber == '<Incident Number>'
    | distinct IncidentName
    | project IncidentName

     

    This query retrieves the unique IncidentName values for a given IncidentNumber. You can replace <Incident Number> with the actual incident number you want to query.

    If you still encounter duplicate values, you can add a "take" operator to the query to limit the results to a single row. Here's an example query that includes both "distinct" and "take" operators:

Resources