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
- High Education Program Advisory Group (HE PAG)
- BBCRM PAG Discussions
- Luminate CRM DC Users Group
- DC Luminate CRM Users Group
- Luminate PAG
- 186 bbcon®
- 1.4K Blackbaud Altru®
- 389 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 14 donorCentrics®
- 355 Blackbaud eTapestry®
- 2.4K Blackbaud Financial Edge NXT®
- 616 Blackbaud Grantmaking™
- 542 Blackbaud Education Management Solutions for Higher Education
- 33 Blackbaud Impact Edge™
- 3.1K Blackbaud Education Management Solutions for K-12 Schools
- 909 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 207 JustGiving® from Blackbaud®
- 6.2K Blackbaud Raiser's Edge NXT®
- 3.5K SKY Developer
- 236 ResearchPoint™
- 116 Blackbaud Tuition Management™
- 375 YourCause® from Blackbaud®
- 160 Organizational Best Practices
- 232 The Tap (Just for Fun)
- 31 Blackbaud Community Challenges
- Blackbaud Consultant’s Community
- 19 PowerUp Challenges
- 3 Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 Raiser's Edge NXT PowerUp Challenge: Events
- 3 Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 Raiser's Edge NXT PowerUp Challenge #1 (Query)
- 71 Blackbaud Community All-Stars Discussions
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 743 Community News
- 2.8K Jobs Board
- Community Help Blogs
- 52 Blackbaud SKY® Reporting Announcements
- Blackbaud Consultant’s Community
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
- Blackbaud Francophone Group
- Blackbaud Community™ Discussions
- Blackbaud Francophone Group