Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8156071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:50:38+00:00 2026-06-06T16:50:38+00:00

I have a .cfc on my server that I use to run a query

  • 0

I have a .cfc on my server that I use to run a query and send the result back to a phonegap app. I cannot get the syntax right to check if any data has been returned in a query and send back a string in the result like “no data found” to display. here’s my code…

remote array function getintList() {
        var q = new com.adobe.coldfusion.query();
        q.setDatasource("myData");
        q.setSQL("select id1, Date, ShowLInk, IntName, description from myData Where intyear = #dateformat(Now(), "YYYY")# order by date desc");
        var data = q.execute().getResult();
        var result = [];
        for(var i=1; i<= data.recordCount; i++) {
            arrayAppend(result, {"id"=data.id1[i], "name"=data.IntName[i], "date"=dateformat(data.date[i], "mmmm d, yyyy"), "description"=data.description[i], "showlink"=data.ShowLInk[i]});
        }
        return result;
    }

Thought maybe I could do a cfif statement like this but it doesn’t work…

<cfif data.recordcount lt 1>
result = "no data"
return result;
<cfelse>
return result;
</cfif>

Hope someone can help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:50:39+00:00Added an answer on June 6, 2026 at 4:50 pm

    Well results is an array.

    If your in phone gap I assume then javascript is handling the result then simply use javascript length on the result.

    ie

    if(result.length){
        //have data doStuff
    }else{
        //noData
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CFC method that I would like to run at an interval
I have a coldfusion cfc that i call to query events between the start
I have a CFC that occasionally needs to send a message via LCDS/BlazeDS to
I have two cfselect boxes that use binds and a cfc. One is State.
I have a group of CFC's that I access from two seperate Applicaiton scopes.
If I have a folder structure that looks like this: / /bin/myComponent.cfc /reports/index.cfm How
CF9, Windows Server 2008 Standard, IIS7, mySQL 5.1.48 community. I have managed to get
Hi I have a CFC/component by name tsks_Session, that performs the session tasks. In
I have a facebook application that was using a CFC I had found on
I have a page that uses a .post to submit to my cfc. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.