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
- 206 bbcon®
- 1.4K Blackbaud Altru®
- 394 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 357 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 646 Blackbaud Grantmaking™
- 561 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 934 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.4K Blackbaud Raiser's Edge NXT®
- 3.6K SKY Developer
- 242 ResearchPoint™
- 118 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 238 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 28 PowerUp Challenges
- 3 (Open) 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
- 778 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

