?
Solved

next and previous field

Posted on 2014-11-13
9
Medium Priority
?
108 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 40439683
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
ID: 40439766
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
ID: 40439775
<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
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 

Author Comment

by:lulu50
ID: 40439784
<cfoutput>6096

the cfoutput tag is from this line

<cfset nextID = listGetAt(appList,pos+1)>
0
 

Author Comment

by:lulu50
ID: 40439829
I solved the issue with the <cfoutput I am testing now
0
 

Author Comment

by:lulu50
ID: 40440002
gdemaria it's working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

ok bye,
lulu
0
 

Author Closing Comment

by:lulu50
ID: 40440009
A+++++++++++++++++++++++++++++++++++++
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 40440066
Thank you!  Glad to help
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 40440080
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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 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