Solved

next and previous field

Posted on 2014-11-13
9
104 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion MS SQL CSV Impport 10 66
cfchart issue with html 6 124
Coldfusion Table display that allows inline edit 3 43
CSS HELP 6 88
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…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

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