Solved

next and previous field

Posted on 2014-11-13
9
101 Views
Last Modified: 2014-11-13
Hi,

<cfset AppList = Cookie.cookieList>
<cfoutput>#AppList#</cfoutput>

I have a list of numbers in a cookie that display like this:

the output:

35,34,7843,6096,3537,7877,1785,7763,7942,936,235,7738

Open in new window



I want to assign the AID  field to the next and previous number.  so, if the url.AppID is 6096 than I need to assign AID field to the next or previous number.

but not sure how to do it.  

I need your help please.


<cfif isDefined("url.nav") and #url.nav# neq ""> 

	<cfif #url.nav# eq "next" and (isDefined("url.AppID")  and #url.AppID# neq "")>
                   
                 <!---   here say the url.AppID is equal to 6096 then I need to assign the field #AID# to 3537 --->
                    <cfset AID = ???>

	<cfelseif #url.nav# eq "previous" and (isDefined("url.AppID")  and #url.AppID# neq "")>

              <!---   here say the url.AppID is equal to 6096 then I need to assign the field #AID# to 7843--->
                      <cfset AID = ???>
    
    <cfelse>
		<cfset AID = 1>
	</cfif>

Open in new window


Thanks
lulu
0
Comment
Question by:lulu50
  • 6
  • 3
9 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
Comment Utility
this will set the nextID and prevID values...

<cfset prevID = "">
<cfset nextID = "">
<cfset pos = listFind(appList,url.appID)>
<cfif pos gt 1>
   <cfset prevID = listGetAt(appList,pos-1)>
</cfif>
<cfif pos lt listLen(appList)>
   <cfset nextID = listGetAt(appList,pos+1)>
</cfif>
0
 

Author Comment

by:lulu50
Comment Utility
Hi gdemaria!!!!!

Good to hear back from you!!!!!

I made the changes but I don't know why my output is this:

<cfoutput>6096

I am not sure why it is printing <cfoutput> tag next to the number!!!!
0
 

Author Comment

by:lulu50
Comment Utility
<cfset prevID = "">
<cfset nextID = "">
<cfset AppList = #Cookie.cookieList#>

<cfif #AppList# neq "" and (isDefined("url.nav") and #url.nav# neq "") and (isDefined("url.AppID") and #url.AppID# neq "")> 
 <cfset pos = listFind(appList,url.appID)>
	<cfif pos lt listLen(appList) and (#url.nav# eq "next" and (isDefined("url.AppID")  and #url.AppID# neq ""))>

		 <cfset nextID = listGetAt(appList,pos+1)>
         <cfset AID = #nextID#>
	<cfelseif pos gt 1 and (#url.nav# eq "previous" and (isDefined("url.AppID")  and #url.AppID# neq ""))>
        <cfset prevID = listGetAt(appList,pos-1)>
         <cfset AID = #prevID#>
    <cfelse>
		<cfset AID = 1>
	</cfif>

<cfelseif isDefined("url.AppID")>
	<cfset AID = #url.AppID#>
<cfelse>
	<cfset AID = 1>
</cfif>

Open in new window

0
 

Author Comment

by:lulu50
Comment Utility
<cfoutput>6096

the cfoutput tag is from this line

<cfset nextID = listGetAt(appList,pos+1)>
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:lulu50
Comment Utility
I solved the issue with the <cfoutput I am testing now
0
 

Author Comment

by:lulu50
Comment Utility
gdemaria it's working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thank you for all your help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  

ok bye,
lulu
0
 

Author Closing Comment

by:lulu50
Comment Utility
A+++++++++++++++++++++++++++++++++++++
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
Thank you!  Glad to help
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
Funny, I was just reading Jim Cramer's Stock recommendations and he suggested buying a stock with the symbol LULU.   Then I saw your question, must be a good sign to buy the stock!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now