Highlighted

Issue with building an array from a cfhttp request result.

Explorer ,
Jan 26, 2015

Copy link to clipboard

Copied

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?

TOPICS
Advanced techniques

Views

298

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Issue with building an array from a cfhttp request result.

Explorer ,
Jan 26, 2015

Copy link to clipboard

Copied

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?

TOPICS
Advanced techniques

Views

299

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 26, 2015 0
BKBK LATEST
Adobe Community Professional ,
Jan 27, 2015

Copy link to clipboard

Copied

What about the obvious? Namely,

<cfif value_from_getqueue IS NOT value_from_cfhttp_request>

<cfset arrayAppend()>

</cfif>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 27, 2015 0