• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Add to cfset

I have two variables simg & limg.
I also have a variable pnum.
How do I do a cfset for the following,
<cfset simg = #pnum# -1>
<cfset limg = #pnum# -2>
So if pnum = 1234, simg would equal 1234-1 and limg would equal 1234-2
0
usky1
Asked:
usky1
1 Solution
 
ZvonkoSystems architectCommented:
Like this:
<cfset simg = "#pnum#-1"  > 
<cfset limg = "#pnum#-2"  >

Open in new window

0
 
chrisP4DCommented:
im not really sure what you're asking because your code is right as far as setting variables up together, you just need to add

<cfset pnum = 1234>
before you do
<cfset simg = #pnum# -1>
<cfset limg = #pnum# -2>

do you need to display the result?
if so, just do
<cfoutput>
simg is equal to #simg# <br>
limg is equal to #limg# <br>
</cfoutput>
0
 
azadisaryevCommented:
or like this:

<cfset simg = pnum & "-1">
<cfset limg = pnum & "-2">
0
 
usky1Author Commented:
Thanks for your quick help on this.
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now