Add to cfset

Posted on 2008-11-06
Last Modified: 2013-12-24
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
Question by:usky1
    LVL 63

    Accepted Solution

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

    Open in new window

    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
    simg is equal to #simg# <br>
    limg is equal to #limg# <br>
    LVL 27

    Expert Comment

    or like this:

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

    Author Closing Comment

    Thanks for your quick help on this.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    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.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now