recordcount is coming as undefined in query

Hi, I have the following code:

the getAreaDetails is returning me json as:

{"STATUS":{"COLUMNS":["REASONID","REASON","CNT"],"DATA":[[9,"Transport Requisition",34]]}}

Open in new window

<cfset Act = getAreaDetails()>
<cfset actID = iif(act.recordcount eq 0, 0, act.status.ReasonID)>

Open in new window

so recordcount is coming as undefined, how can i make a check instead of recordcount, so it does not throw me an error
LVL 16
Gurpreet Singh RandhawaCEOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

this isn't a query - recordcount is only for queries - need to ask json.length instead.
what do you get when you ask ArrayLen(Act) ? or something similar ...
Gurpreet Singh RandhawaCEOAuthor Commented:
i tried for arraylen but it throw me an error
If it throws an error it means (probably) that it is not an array - simple as that.
Did you convert it to an array?

You may need to convert it into a ColdFusion array.

Here is an excerpt taken directly from the Docs:

<!--- Get the JSON Feed ---> 
<cfhttp url="http://localhost:8500/My_Stuff/Ajax/Books/CreateJSON_NEW.cfm"> 
<!--- JSON data is sometimes distributed as a JavaScript function. 
     The following REReplace functions strip the function wrapper. ---> 
<cfset theData=REReplace(cfhttp.FileContent,  
<cfset theData=REReplace(theData, "\s*\)\s*$", "")> 
<!--- Test to make sure you have JSON data. ---> 
<cfif !IsJSON(theData)> 
    <h3>The URL you requested does not provide valid JSON</h3> 
    <cfdump var="#theData#"> 
<!--- If the data is in JSON format, deserialize it. ---> 
    <cfset cfData=DeserializeJSON(theData)> 
    <!--- Parse the resulting array or structure and display the data. 
             In this case, the data represents a ColdFusion query that has been 
             serialized by the SerializeJSON function into a JSON structure with
             two arrays: an array column names, and an array of arrays,  
             where the outer array rows correspond to the query rows, and the 
             inner array entries correspond to the column fields in the row. ---> 
    <!--- First, find the positions of the columns in the data array. ---> 
    <cfset colList=ArrayToList(cfData.COLUMNS)> 
    <cfset cityIdx=ListFind(colList, "City")> 
    <cfset tempIdx=ListFind(colList, "Temp")> 
    <cfset fcstIdx=ListFind(colList, "Forecasts")> 
    <!--- Now iterate through the DATA array and display the data. ---> 
        <cfloop index="i" from="1" to="#ArrayLen(cfData.DATA)#"> 
            Current Temperature: #cfData.DATA[i][tempIdx]#<br><br> 
            <cfloop index="j" from="1" to="#ArrayLen(cfData.DATA[i][fcstIdx])#"> 
                <b>Day #j#</b><br> 
                Outlook: #cfData.DATA[i][fcstIdx][j].WEATHER#<br> 
                High: #cfData.DATA[i][fcstIdx][j].HIGH#<br> 
                Low: #cfData.DATA[i][fcstIdx][j].LOW#<br><br> 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gurpreet Singh RandhawaCEOAuthor Commented:
ok, i will check it
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.