Solved

next and previous field

Posted on 2014-11-13
9
106 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 500 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I use EncodeForURL() in ColdFusion with CFGRID 5 66
Align a <div> to a table row 3 96
coldfusion, jQuery help 25 117
coldfusion cfloop help 6 41
This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

742 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