Query API - if no results, don't create file

Options

I'm trying to figure out how to look at the returned results from a Query using the Query API and if there are no results, don't create a file.

The results of the query are in the URL passed back. I'm not sure how to split that up so I can see if there is a second row of data that isn't the headers.

45f30a2d810c031f0d2327dc466f3f0c-huge-im

Thanks,

Carol

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Carol Grant
    if you use CSV:

    length(split(trim(base64ToString(body('HTTP_-_Get_query_results')?['$content'])), outputs('Compose_New_Line')))

    where you have a “Compose” action (named “Compose New LIne”) that has a new line character (just type “Enter” key in the compose).

    OR

    length(split(trim(base64ToString(body('HTTP_-_Get_query_results')?['$content'])), decodeUriComponent(' ')))

    the length=1 means no data row

    ===================================

    if you use JSON:

    length(base64ToString(body('HTTP_-_Get_query_results')?['$content']))

    length=0 means no data row

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    Actually, it's simpler than that lol.

    In the get execute job status, on the one that you got the sas_uri, there's a property (new) “row_count” that shows on JSON or CSV output option.

    7bc2361de62793931569da9db5f430d5-huge-im
  • @Alex Wong- Thank You! That worked, there was an extra parentheses in the highlighted area below, but that worked.

    length(split(trim(base64ToString(body('HTTP_-_Get_query_results')?['$content']))), outputs('Compose_New_Line')))

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Carol Grant
    lol on the extra paranthesis. always the hardest part of typing expression in notepad, making sure all “open” and “close” line up.

    Updated the original post to remove the extra close paranthesis

Categories