Query API - if no results, don't create file
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.

Thanks,
Carol
Comments
-
@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
0 -
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.
2 -
@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')))
0 -
@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
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 213 bbcon®
- 1.4K Blackbaud Altru®
- 403 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 656 Blackbaud Grantmaking™
- 576 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 939 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.6K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 248 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 241 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 34 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 793 Community News
- 2.9K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

