Solved

# Add to cfset

Posted on 2008-11-06
350 Views
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
Question by:usky1

LVL 63

Accepted Solution

Like this:
``````<cfset simg = "#pnum#-1"  >

<cfset limg = "#pnum#-2"  >
``````
0

LVL 3

Expert Comment

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

LVL 27

Expert Comment

or like this:

<cfset simg = pnum & "-1">
<cfset limg = pnum & "-2">
0

Author Closing Comment

Thanks for your quick help on this.
0

## Write Comment

Please enter a first name

Please enter a last name

We will never share this with anyone.

## Featured Post

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

#### 779 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!