Solved

next and previous field

Posted on 2014-11-13
9
105 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
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iPhone looses session info 5 30
cfchart display 12 104
Can I evaluate a variable in the value attribute of <cfhttpparam>? 2 46
Coldfusion cfscript DELETE function 7 28
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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