Skip to main content
Inspiring
January 26, 2015
Question

Issue with building an array from a cfhttp request result.

  • January 26, 2015
  • 1 reply
  • 473 views

Here is what I am trying to do. Retrieve a bunch of results from a  REST request. Run a query to see if I should be excluding any of the xmltext entries coming back from the rest request. Build an array of the REST xmltext entries except the entries in the cfquery.

I have it all workign except building the array minus the entries that came back in the cfquery. Here is my code so far.

<cfquery name="getqueue" datasource="#application.settings.dsn#">

select * from friends

where Deactivatedate < #DATEADD('d', 1, CreateODBCDateTime(now()))#

</cfquery>

<cfoutput query = "getqueue">

<cfhttp  blah blah>

<cfset nodes_parse = XmlParse(CFHTTP.FileContent)>

<cfset Nodes = xmlSearch(nodes_parse,'friends/friend/date/activedate/')>

<cfset roleArray = ArrayNew(1)>

<cfloop from="1" to="#arraylen(Nodes)#" index="i">

  

   <cfset NodeXML = xmlparse(Nodes)>

<cfset ArrayAppend(roleArray, '[sel_members][]=#NodeXML.activedate.xmlText#&')>

 

</cfloop>

</cfoutput>

My issue is down in the loop where I do the arrayappend. How would I build an array of values coming back from the cfhttp request but not include any of them if they match up with anything coming back from the getqueue query?

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
January 27, 2015

What about the obvious? Namely,

<cfif value_from_getqueue IS NOT value_from_cfhttp_request>

<cfset arrayAppend()>

</cfif>