Saving CF codes in a variable

Hi,
I am trying to save some rather lengthy CF codes in a variable, ie. <cfset mycode = " ... all the codes here ...">.  However the codes to be saved may contain double quotes (") which would create a conflict.  I know of cfsavecontent which does not require double quotes; however that tag would process the codes rather than save them as string.
Is there an alternative way to saving the codes as a string in a variable?
Thanks,
MCL

For some reasons, I wasn't able to save this input into a variable.  I ended up having to save them in a file and call it as a template using cfinclude.
Code needs to be compiled before it's executed, and the compile process runs before the code is run.  So one cannot have runtime expressions that write code and then have the expectation of it then being able to be executed within the same template.
As Dan alludes to, the only way of doing what you want to do is to write the source code to file, then <cfinclude> the file.  Including an file that has not yet been compiled will trigger the compilation process before executing it, so your "runtime" code will indeed execute.
Adam

Similar Messages

  • Capturing oracle error codes into a variable

    Hi
    Can someone show me how it is possible to save an Oracle defined error code into a variable? What I am trying to do is when a stored procedure fails an Oracle error is raised, such as ORA-xxxx, then pass this code into variable to be saved into a log.
    How do I achieve this?

    user633278 wrote:
    How do I achieve this?Function SQLCODE in PL/SQL exception handler returns error code. SQLERRM returns message:
    SQL> declare
      2      x number;
      3  begin
      4      x := 1/0;
      5    exception
      6      when others
      7        then
      8          dbms_output.put_line('Error code: ' || SQLCODE);
      9          dbms_output.put_line('Error message: ' || SQLERRM);
    10  end;
    11  /
    Error code: -1476
    Error message: ORA-01476: divisor is equal to zero
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Unable to debug/correct the CMOD code for a variable used in a query

    unable to debug/correct the CMOD code for a variable used in a query
    i am using the data in a DSO in a query and using a custom coding variable in that query , but this data not coming in that query ..
    can anyone suggest how to debug that cmod code for the variable?
    code is written in CMOD tocde for the variable.

    belowis the code that i have written for a custom coding for a variable
    *******Start***
    IF i_step = 2.
      CASE i_vnam.
        WHEN 'IC_COMPCD'.
         TYPES:       BEGIN OF gt_itab_DyAuthTable,
                           username  TYPE /bic/afiop_o1200-/BIC/IC_USER,
                           companycode TYPE /bic/afiop_o1200-COMP_CODE,
                      END OF gt_itab_DyAuthTable,
                      BEGIN OF gt_itab_Cocd_all,
                            companycode TYPE /BI0/MCOMP_CODE-COMP_CODE,
                      END OF gt_itab_Cocd_all.
          DATA: gi_itab_DyAuthTable TYPE STANDARD TABLE OF gt_itab_DyAuthTable,
                wa_itab_DyAuthTable TYPE gt_itab_DyAuthTable.
           DATA: gi_itab_Cocd_all TYPE STANDARD TABLE OF gt_itab_Cocd_all,
                wa_itab_Cocd_all TYPE gt_itab_Cocd_all.
          SELECT /BIC/IC_USER
                 COMP_CODE FROM /bic/afiop_o1200
            INTO CORRESPONDING FIELDS OF TABLE gi_itab_DyAuthTable
            WHERE /bic/ic_user = sy-uname.
          LOOP AT gi_itab_DyAuthTable INTO wa_itab_DyAuthTable.
            IF wa_itab_DyAuthTable-companycode EQ '*'
              OR
              wa_itab_DyAuthTable-companycode EQ ' '.
              SELECT COMP_CODE FROM /BI0/MCOMP_CODE
                  INTO CORRESPONDING FIELDS OF TABLE gi_itab_Cocd_all.
              LOOP AT gi_itab_Cocd_all INTO wa_itab_Cocd_all.
                l_s_range-low    = wa_itab_Cocd_all-companycode.
                l_s_range-sign   = 'I'.
                l_s_range-opt    = 'EQ'.
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
          to exit the loop if any one value is */space/all for a user's compcode values
            EXIT.
            ENDIF.
          ENDLOOP.
           if control is here means, the comp codes values didnt have */space
              LOOP AT gi_itab_DyAuthTable INTO wa_itab_DyAuthTable.
                l_s_range-low    = wa_itab_DyAuthTable-companycode.
                l_s_range-sign   = 'I'.
                l_s_range-opt    = 'EQ'.
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
      Endcase.
    Endif.

  • I'm trying to export a file as .dwg for Autocad but it's not showing the dwg preview and it appears to be saving as code (lots of gobbledegook when reopening the file).  I'm on OS 10.5.8.  Never had a problem with this before.  What am I missing? Any idea

    I'm trying to export a file as .dwg for Autocad but it's not showing the dwg preview and it appears to be saving as code (lots of gobbledegook when reopening the file).  I'm on OS 10.5.8.  Never had a problem with this before.  What am I missing? Any ideas?

    First be sure login and password are OK. Sometimes the address starts wit "http://..." and sometime starts with "ftp://...". Try both normal FTP access and Scure FTP access (SFTP). At the end, contact the site's provider.

  • I opened a Sync account before, and without saving the code I uninstalled it. But now using installed it again but do not have my Sync code to add the device. Is there anyway I can retrieve the code, without creating another account? Thanks!

    I created a Sync account before but uninstalled it without saving the code. But now installed it again and having trouble finding my account code to setup my Sync. Is there a way to retrieve my Sync code without creating another account?
    Thanks!

    Contact iTunes:
    Apple - Support - iTunes - Contact Us

  • Auto Display saved BP Code

    Hi all
    How to activate this auto display saved BP Code without searching from the selection button?
    Kedalene Chong

    Hi,
    1. Run below query and assign this query in sales order customer field without selecting auto refresh option.
    SELECT T0.[CardCode], T0.[CardName] FROM OCRD T0 WHERE T0.[CardType]  = 'c' ORDER BY T0.[CardCode]
    2. While creating Sales order, just press Shift + F2 to display BP code & Name
    Thanks & Regards,
    Nagarajan

  • Short dump while saving data after selecting '#' for variable in WI

    Hello All,
    We have a selection variable in our webinterface on company code.After selecting '#',i am entering data and while saving it goes to dump.
    but client wants to have an error message displayed after saving data instead of runtime error (dump).so that user can select required company code.
    Error analysis is:
    A RAISE statement in the program "SAPLRSDRI" raised the exception   
    condition "ILLEGAL_INPUT".                                          
    Since the exception was not intercepted by a superior program       
    in the hierarchy, processing was terminated.                        
    Short description of exception condition:                           
    For detailed documentation of the exception condition, use          
    Transaction SE37 (Function Library). You can take the called        
    function module from the display of active calls.                   
    Is there any way to get desired  result?
    Thanks

    Hello Murali,
    What you would need to do is to change the attributes of the variable.
    1. In BPS0, you can make it as a mandatory entry.
    2. In the web layout, you can create a variable for Company code and force the user to choose a value from a dropdown list.
    The specific approach would depend on how the layout is being called and how it has been setup.
    Hope this helps.
    Sunil

  • Problems saving/ displaying codes

    Hello,
    I want to save html codes or any language code in my database.
    For instance, am saving the text below in the database :
    <!--- STRIP OUT ALL HTML --->
    <cfset test = StripToHTML.stripHtml(VARIABLES.text, "all")>
    <cfdump var="#test#"><br/>
    <!--- STRIP OUT IMG, B, AND EM TAGS --->
    <cfset test1 = StripToHTML.stripHtml(VARIABLES.text, "img,tag,false;b,tag,true;em,content,true")>
    <cfdump var="#test1#"><br/>
    When it has been saved in the database, it's like follows :
    &lt;!--- STRIP OUT ALL HTML ---&gt;
    &lt;cfset test = StripToHTML.stripHtml(VARIABLES.text, "all")&gt;
    &lt;cfdump var="#test#"&gt;&lt;br/&gt;
    &lt;!--- STRIP OUT IMG, B, AND EM TAGS ---&gt;
    &lt;cfset test1 = StripToHTML.stripHtml(VARIABLES.text, "img,tag,false;b,tag,true;em,content,true")&gt;
    &lt;cfdump var="#test1#"&gt;&lt;br/&gt;
    And when I am displaying it on a page, it displayed as above.
    Someone can tell me how to save the codes in the correct format in the database and how to make them display correctly ?
    I am using MSSQL 2008 for the database.

    well I have used the function safetext but unfortunately its not good.
    I have test it with the test below :
    Hello V/s <b>Hello</b>
    and the result after using safetext qive me the result :
    Hello  V/s &lt;b&gt;Hello&lt;/b&gt;
    I have already do a rereplace function to replace the &lt; and &gt; with <> but this would appear like :
    Hello  V/s Hello
    Instead of showing the tag b , it execute the html tag.
    I don't know how to make any codes appear on a page.
    Could anyone please help me ?

  • Display html code in a variable of a pojo failed by JSTL

    hai,
    my pojo contains the following code:
    Class Pojo{ String htmlFormat="<a href='someurl'>click</a>";  setters and getters}
    in my jsp displaying this pojo variable <c:out value="${htmlFormat}" /> is displaying it as text but the content is of type html ,but working fine if display the same with expression like
    <%=pojo.getHtmlFormat() %>
    and my jstl version is 1.1
    any help will be helpful
    thanks,
    udai

    Hi,
    As Evnafets suggest you can use c:out tag. Or you can use apache commons api.
    For example:
    <%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
    <%=StringEscapeUtils.escapeHtml("<h1>stands for heading tag</h1>")%>I feel Evanfets suggestion is better. If want to have escape in the POJO before giving to view. You can use the apache api.
    ~Balaji
    Edited by: Balaji Chopparapu on Oct 14, 2010 4:21 AM

  • Problem in Saving Image Code

    Hi, I'm been dealing with this code that should be saving an image as a JPEG format.
    public static void saveAsJPEG(RenderedImage image, String file)
    throws java.io.IOException {
    String filename = file;
    if(!filename.endsWith(".jpg"))
    filename = new String(file+".jpg");
    OutputStream out = new FileOutputStream(filename);
    JPEGEncodeParam param = new JPEGEncodeParam();
    ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", out, param);
    encoder.encode(image); out.close(); }
    However, when I compile the code, there's an error come out : com.sun.image.codec.jpeg.JPEGEncodeParam is abstract; cannot be instantiated
    I really can't figure out the meaning of this exception. So, would somebody kindly tell me what is wrong with the code?
    And another question is : What package is the ImageCodec located? Thanks a lot :)

    try this out and let me know;
    public static void saveAsJPEG(BufferedImage image, String file)
    throws java.io.IOException {
    String filename = file;
    if(!filename.endsWith(".jpg")) filename = new String(file+".jpg");
    OutputStream out = new FileOutputStream(filename);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); // Create JPEG encoder
    JPEGEncodeParam jpegParams = encoder.getDefaultJPEGEncodeParam(image);
    jpegParams.setQuality(1.0f, false); // Set quality to 100% for JPEG
    encoder.setJPEGEncodeParam(jpegParams);
    encoder.encode(image); // Encode image to JPEG and send to browser
    //JPEGEncodeParam jpegPparams = new JPEGEncodeParam();
    //ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", out, jpegParams);
    //encoder.encode(image);
    out.close(); }

  • Day Light Saving Time .Code

    Hello,
    I am developing one application, which includes time handling of normal time and DST as well.
    I am searching for a help(or code) , by which I get to know how to handle DST changes in java code.
    My requirement :
    Suppose in 2nd Nov 08 , GMT -8 , Central Daylight Time ends and CST starts , mean clocks will move backwards 1 hr i.e. from 2 am to 1 am. On my website I am showing time combo box to customer , where customer will select a time in HH:MM
    Now if customer has selected 2:09am , which in turn gonna be 1:09 as DST ends and clocks will move backward 1 hr. So how to handle this DST change java code, so that when customer enters 2 am it will be saved as 1 am in database when its in DST,
    Please help me. A code provision would be great help.
    thanks in advance
    Ani

    this code has directly hard coded the rules of the DST timings and i.e. for US only, I am looking out for a generic code that would take care of all DST time zones. I have latest TZ library downloaded form SUN site.

  • BW Transaction Code to View Variable ABAP Code

    Hello All,
      Is there a BW Transaction to view Variable ABAP Code?
    Thanks!

    hi Tina,
    If you are looking for Customer Exit Variable ABAP Code,
    1) Tcode: SE80 (Here select Class and Interface and give the technical name and display, you will get all customer exit variables created)
    2) Tcode: CMOD. Give Project name and then goto "components" --> Function Exit and in the code, goto "ZXRSRU01".
    3) Tcode: SE19 (Now, generally CMOD is not used, BADI is used. Initially SPOT enhancement implementation is created which can have many BADI Implementations and for each BADI implementation, class and filter is created where you write code for variable given in Filter.)
    Hope it helps
    Regards
    Lavanya

  • Error Code 17306 Unknown Variable or Property Name " Locals.Mod​el"

    I get the above message when i run the step f(x) SetFileGlobal operator...No code module adapter is used.
    I have attached my seq file and only second and third step are erroring out..I checked the rest of the sequences they work fine. Any help is appreciated.
    Thanks
    Attachments:
    0960.seq ‏42 KB

    Hi,
    Open your sequence file in the Sequence Editor.
    Select the Sequence that you wish to add Locals to, and make this the active sequence i.e the one thats visible to you, Usually it displays the MainSequence  when first loaded.
    Select the Locals Tab
    In the right hand side of the display, there will be the variable ResultList.. This will be an empty array of Result.
    Place your cursor in this position of the display and press the Right Mouse button. You will see an a popup menu of which the Top Item is Insert Local.. If you select this you will get an other set of options which are the different types of Variables that are available to you. Select a variable type, such as a Number. This will be inserted into right hand side under the ResultList array. It will be highlight ready for you to enter the name of the variable. If you double click on the variable you will get the Properties Dialog. You will beable to a new value.
    The User Manual, should beable to explain on this.
    I would recommend trying to get on the Basic TestStand course.
    hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Error codes for shared variables in Labview 8.5?

    I am trying to use Shared Variables in Labview 8.5 to enable real-time loops (similar to some of the examples in "Using the LabVIEW Shared Variable", published Aug 28, 2007).  I created it to hold the result of a 16-channel A/D converter (so a 16-element I16 array).  To avoid losing samples, I used buffering, with a buffer of 5.  To test this, I made a pair of VIs, one a producer that stuffs a 16-element I16 array into the shared variable "every so often" (controlled by a timed loop), and a consumer loop that reads the shared variable and does something with the data.
    If I think of the buffered shared variable as a Real Time FIFO (as the article suggests it is), I was curious how I would know (a) when the queue was empty, and (b) if the queue had overflowed.  Both are necessary if this is to be a practical means of exchanging data -- you want the producer and consumer to run more-or-less at the same rate, but only the producer is deterministic.  The consumer needs to be able to run "faster" if it falls behind (for example, because it is writing data to disk), but you don't want it to read data from the shared variable if there's nothing there.  [One can always read a shared variable, after all -- as the article states, it simply "holds" the last value written to it].
    Snooping around, I discovered that there are "error codes" associated with the shared variable.  In particular, a code of -2220 (FFFFF754) seems to signify an empty queue (or a shared variable that has not yet been written to), while a code of -1950678981 (8BBB003B) appears to be "buffer overflow".
    Is this documented anywhere?  Are there other "error codes" that would be helpful to know?  Is there some rationale to these seemingly-random numbers?  [It would help to develop code to utilize shared variables if there was a bit less "magic" and "mystery" involved].
    For what it is worth, with a buffer of size 40, I could generate 16 I16 values at 1 KHz (simulating sampling from a 16-channel A/D at 1 KHz) and pass it to a consumer node that (a) read from the shared variable until it was empty, then (b) "went to sleep" for 20 msec (simulating "doing something else non-deterministically"), and not miss any data (because I could then empty the Shared Variable RT-FIFO, which should have been half full, before it overflowed on me).  Not bad throughput -- I bet I could push it even higher.
    Bob Schor

    Hey Bob,
    The errors are documented in the LabVIEW help:
    Shared Variable Error Codes
    Real-Time Shared Variable Error Codes
    There are several error messages for buffer underflow/overflow depending on the settings of the network or RT FIFO buffers. In particular the -2220 and -2221 are useful for the producer/consumer use case. For example (as you probably know) the consumer can flush a variable using the error code (see the attached image).
    Gerardo
    Attachments:
    variable1.png ‏3 KB

  • Where to put init code for static variables? (for UIImages)

    I know that static variables are sorta a global, is that how UIImage is usually stored? What is the convention to declare UIImage variables that exists throughout the lifetime of the app? Where is a good place to init it if I choose to use static variables?

    OK, in that case do something like this:
    MyClass.m
    #import "MyClass.h"
    static UIImage *classImage;
    @implementation MyClass {
    + (void)initialize {
    classImage = <whatever to load image>;
    Code like the above makes the 'classImage' variable work like a typical class variable. It is available to all instances of MyClass but is not visible to other classes. Like a 'private static' class variable in Java. Nothing goes in the header for this variable.
    The 'initialize' method is called once the first time anything ever references MyClass. Kind of like a static initializer in Java. Notice the use of '+' instead of '-' for the method. The '+' makes it a class method instead of an instance method.
    Does that help?
    Message was edited by: RickMaddy

Maybe you are looking for

  • How to access calendar rules via java

    Hi to all, We have a process in which we need to set a Timer, but the date must be validated against Calendar Rules. We searched in forums, webs, documentation and we couldn't find a way to do this. I know it is possible to set an expiration date bas

  • Syncing iTools with MobileMe

    iSync on my older PowerBook G4 still wants to sync with my old iTools account, while iSync on my newer PowerBook Pro wants to sync with MobileMe. The result is two calendars on an iTouch - an iTools calendar and a MobileMe calendar (and, of course, t

  • I cant download the iBook app to my new iPad.

    I am a complete newbie to apple, and must be missing something pretty basic, but I cant seem to download the iBook app to my iPad. I have tried twice, but it doesnt seem to have worked. When I touch the App Store icon, then the Purchased Icon at the

  • I need a mechanism to expose action script class reference to java script

    I need a mechanism to expose action script class reference to java script

  • VarArg parameters and its outcome

    Hi, just to be sure about continuity. At the moment, if you have a method like void myMethod(Object ... objects);The following calls will result in the respective objects value: myMethod()results to objects == Object[]{}and myMethod(null)results to o