• 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
1 Solution
ZvonkoSystems architectCommented:
Like this:
<cfset simg = "#pnum#-1"  > 
<cfset limg = "#pnum#-2"  >

Open in new window

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
simg is equal to #simg# <br>
limg is equal to #limg# <br>
or like this:

<cfset simg = pnum & "-1">
<cfset limg = pnum & "-2">
usky1Author Commented:
Thanks for your quick help on this.

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