Using a dot "." in defining/scoping variables

I've always felt it was a best practice to scope EVERY CF
variable and still do. However, a new co-worker to me feels that
using a DOT in variable names could cause problems. I completely
disagree but would like others opinions. To me scoping variables is
absolutely a best practice.
She specifically referred to the article below but to me the
point of this article was about using "primitive" variables such
as: "var1.var2.var3".
http://www.coldfusionmuse.com/index.cfm/2006/3/14/dot.operator
Looking forward to others opinion especially seasoned CF
folks from Adobe.

NUHuskers65 wrote:
> I've always felt it was a best practice to scope EVERY
CF variable and still
> do. However, a new co-worker to me feels that using a
DOT in variable names
> could cause problems. I completely disagree but would
like others opinions.
> To me scoping variables is absolutely a best practice.
>
I think this co-worker misunderstood the point of that
article as
surmised in its last paragraph, and I quote:
"The solution is to avoid using dotted notation for primitive
variables.
Only use dotted notation for variable naming when you intend
to create a
structure."
All variable scopes in modern, aka MX, aka Java Based,
ColdFusion are
structures. You use the dot [.] character to specify the keys
of
structures. So you are doing what you are supposed to do.
This article refers to older versions of ColdFusion where all
the
variable scopes where *not* structures and you could get away
with dots
in your primitive, i.e. non-structure, variable names. It
also tells
how one can still do this by using array notation.
This is a bad practice and should be avoided for the very
reason that in
modern ColdFusion, dots are meant to be interpreted as
structures. It
does not say to not even use dots for these structures where
they are
meant to be used.

Similar Messages

  • How can I define global variable in user exit whic I can use anywhere.

    Hi all,
    How can I define global variable( Table ) which I can use when it come back to same user exit where I defined and stored some data.
    What I mean is I want to define 1 global table.
    In user exit when it comes I store some information. and again when it will come I will have that stored information so I can use it.
    Thanks a lot in advance.

    You can use EXPORT  TO MEMORY ID and IMPORT FROM MEMORY ID Statement for this.
    EXPORT T_ITAB FROM T_ITAB TO MEMORY ID 'ABC'.
    IMPORT T_ITAB TO T_ITAB FROM MEMORY ID 'ABC.'

  • Can we access the session scoped variable by simply using its name

    The Java EE 6 Tutorial contains a "Duke's Bookstore Case Study Example”. I could not understand following statements of this case study:
    *bookdetails.xhtml*
    {code}
    <h:outputText value="#{selected.title}"/>
    {code}
    *BookstoreBean.java*
    {code}
    public String details() {
    context()
    .getExternalContext()
    .getSessionMap()
    .put(
    "selected",
    getFeatured());
    return ("bookdetails");
    {code}
    I want to know can we access the session scoped variable in bookdetails.xhtml by simply using its name as done above?

    It is basic Expression Language (EL) functionality, it isn't even specific to JSF. And it isn't specific to the session scope either, you can put beans in any scope (page, request, session, application, flash, conversation, whatever custom scope you create) and reference it using EL by only its name. The thing that you have to take care of is that the bean lives in SOME scope, which can be achieved using JSF specific annotations or configuration files, through CDI or by manually putting the bean in a specific scope through Java code. It's flexible, which is the nature of the Java platform.

  • Using column_name%TYPE to define variable type behaves differently..

    CREATE TABLE a_table(a_column VARCHAR2(10))
    PROCEDURE x(in_arg a_table.a_column%TYPE)
    IS
    tmp_arg a_table.a_column%TYPE;
    BEGIN
    tmp_arg := in_arg;
    END x;
    EXEC x('this string is longer than 10 chars');
    -> x:Line 1:Error, buffer too small.
    Why?
    Presumption: using table.column%TYPE in the args list takes only the TYPE. Using it to declare a temp variable, takes the TYPE AND the SIZE of the column..

    You have declared a 10 char max column here
    CREATE TABLE a_table(a_column VARCHAR2(10))And inside your procedure you declare an x variable sized the same as your column, with a maximum 10 characters length, but you declared a constant string with more than 10 characters, so the result is a buffer too small or a string too big.
    EXEC x('this string is longer than 10 chars');
    -> x:Line 1:Error, buffer too small.~ Madrid

  • When I define a variable in BO it automatically turns it into a detail

    i have made a user prompt in my report
    so the user can input a value that does not exist in universe so i can use it as condition or a filter,
    i have done this by using the followiing condition in the query
       object = object
    or
       object = ToPrompt("Give number")
    As you can see by the logic this condition will ALWAYS be true because object  = object  is always true. So this logic will not impact the rest of the query it will just allow to enter any value in the user prompt
    in the report when i try to create a new variable
    =ToNumber(UserResponse ("Query 1 with NEW_UNIV" , "Give number"))
    it automatically turns it into a detail and i cant change it to measure or dimension.
    is there a way to fix this
    thanks in advance

    some one answered in the following link
    [When I define a variable in BO it automatically turns it into a detail;

  • Permissions needed for user to define workflow variable

    Hi all
    im using a workflow on sharepoint designer 2007, running on list of customer orders. the workflow is trying to use data from customer list.
    In the workflow i used the "define workflow variable" step on customer order list. the users who are using the order list have Contribute permission so they can add items. on the customer list they have read permission.
    when an item is created, the workflow is suppose to generate the varieble by combining data from the two lists: selecting the customer from the current order item and suppose to combine it with data from the customer list for that specific customer
    and keeps it in the variable.
    for users with full control permission for the site, the workflow is completed ok. for the users with the contribute and read permissions it ends with an error and doesnt store the variable (i cheked it by storring the variables in the workflow history).
    what are the permission needed to manage to do the action of storring the variable?
    or any other ideas for the error?
    Thanks in advance

    Hello Cajuntank and welcome to the Palm forums.
    Palm Desktop needs to be installed with the local administrator priviledge during the install of Palm Desktop, the HotSync Manager, the first HotSyn sync, and the installation of any third-party conduits on the desktop.
    After that, the local admin rights can be revoked.
    Alan G

  • Define Global Variable in XSLt

    H,
    Please let me know how to define Global Variable in XSLT.
    I have define a variable under for-each and i want to use that variable after for-each.
    Please suggest on the same.
    Thanks,
    Pradeep

    Hi Pradeep,
    IN XSL design, right click on target node and then select --> Add Variable. Give the name you desire to that variable and click OK. You can use that variable anywhere in that particular XSLT. In the source xsl you will see entry like this after adding your variable
    "<xsl:variable name="your variable name">value you want to give</xsl:variable>".
    Hope this helps.
    Regards,
    Karan

  • Define query variable

    Hi Experts
    I want to run a  query using parameters. can you please provide me instructions on how to create the parameters. Basically what i want is to be able to select the query and then the ' define query variables' to pop up in-order for me to enter the variables.
    What do i need to do to prompt for this 'define query variable' window
    Thank you
    Regards
    Apsara

    Hi!
    Try this !
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Set @FromDate = (select min(S0.DocDate) from OINM S0 Where S0.Docdate >= '[%0]')
    Set @ToDate = (Select max(S1.Docdate) from OINM S1 Where S1.DocDate <='[%1]')
    SELECT T0.* FROM vw_HHBookingAdvice T0 WHERE T0.BookingDate >= @Fromdate and T0.BookingDate <= @ToDate

  • Key Date- Can i define 2 variables

    Hi Guru's,
        I have a requirement to define 2 variables in Bex- Key date.
    I am thankfull for any inputs of how to go about.
    Thanks
    Hari

    Hi,
    Here you should have 2 -  valid to and 2 - valid from fields in the datatarget .One set of Valid to and valid from fields for  Characterstics ZA and another set ofValid to and valid from fields for  Characterstics ZB. And then you can use RKF concept to get the required output .
    But it is not at all possible throygh Key date as you exepecting. If I remeber correctly Thats what I suggested you in one of the previous threads.
    With rgds,
    Anil Kumar Sharma .P

  • Best practices for defining Environment Variables/User Accounts in Linux

    Hello,
    After reading throught the Quick Install guide for 10gR2 on x86_64 Linux, I see that it is not recommended to define ANY variables in .bash_profile.
    I'm hoping to get a Best practices approach for defining environment variables - right now we use the oracle linux account for administration including sql*plus. So, where should the myriad variables be defined? Is it important enough to create a user account in linux to support best practices?
    What variables, exactly, should be defined? It seems that LD_LIBRARY_PATH is no longer being used?
    Thanks in advance
    Doug

    Something that I've done for years on unix/linux boxes is to create a seperate environment variable setup file for each instance on the box. This would include things like ORACLE_HOME, ORACLE_SID, etc. Then I would create an alias in my .bash_profile that would execute this script. As an example, I would create a orcl.env file that would hold all of the environment variables for this instance. Then in my .bash_profile I would create a line like the following:
    alias orcl=". $HOME/orcl.env"
    Then from anywhere you could type orcl and you would set your environment to connect to that database.
    Also, if you are using 10g, something else that is really nice if you are using sqlplus, and you connect to different databases without starting a new sqlplus session is to set a parameter in your $ORACLE_HOME/sqlplus/admin/glogin.sql file:
    set sqlprompt "_user 'at' _connect_identifier >"
    This will automatically change your command prompt to look like this:
    RALPH at ORCL >
    if you connect as GEORGE, your prompt will immediately change to :
    GEORGE at ORCL >
    This way you can always know who and where you are connected to.
    Good luck!

  • Error when defining a variable from a class

    Hi,
    I'm getting this error message when trying to define a
    variable from a class:
    '1086: Syntax error: expecting semicolon before left paren.'
    I can't see where the error is.
    The scripts Question.as and Codeframe.as is located int the
    folder Mycomponents under the project.
    Regards
    /Acke
    **** Main app *****
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.CloseEvent;
    import myComponents.*;
    var Question():myComponents.Question=new Question(); // !!
    This line causes the error !!
    other code goes here....
    ]]>
    </mx:Script>
    **** The class definition ******
    package myComponents
    //import other classes needed
    import Mycomponents.Codeframe
    public class Question {
    // Define properties and methods.
    // Define public vars.
    public var Qtype:string;
    public var Condition:string;
    public var Qnumber:string;
    public var Qheading:string;
    public var Pretext:string;
    public var Qtext:string;
    public var Posttext:string;
    public var Codeframe():string;
    public var Reserved:string;
    public var EditableFrom:string;
    public var EditableTo:string;
    public var Decimal:string;
    public var SetQfactor:string;
    public var Logic_if():string;
    public var Logic_then():string;
    // Public constructor.
    //public function Question(){
    // do stuff to set initial values for properties
    public function Question(Type:string,
    Condition:string,
    Qnumber:string,
    Qheading:string,
    Pretext:string,
    Qtext:string,
    Posttext:string,
    Codeframe():string,
    Reserved:string,
    EditableFrom:string,
    EditableTo:string,
    Decimal:string,
    SetQfactor:string,
    Logic_if():string,
    Logic_then():string,
    ):Void
    this.Type=Type;
    this.Condition=Condition;
    this.Qnumber=Qnumber;
    this.Qheading=Qheading;
    this.Pretext=Pretext;
    this.Qtext=Qtext;
    this.Posttext=Posttext;
    this.Codeframe()=Codeframe();
    this.Reserved=Reserved;
    this.EditableFrom=EditableFrom;
    this.EditableTo=EditableTo;
    this.Decimal=Decimal;
    this.SetQfactor=SetQfactor;
    this.Logic_if()=Logic_if();
    this.Logic_then()=Logic_then();
    }

    1.
    It should be
    var theQuestion:Question = new
    Question(sType,sCondition:string,sQnumber,sQheading,sPretext,sQtext,sPosttext,
    sCodeframe,sReserved,sEditableFrom,sEditableTo,sDecimal,sSetQfactor,sLogic_if,sLogic_then )
    As you don't have default values in the constructor - you
    should specify the parameters.
    2. why do use type "string" ? It should be "String" if you
    refer to a standard type
    3. What are you trying to say by this:
    public var Codeframe():string;
    public var Logic_if():string;
    public var Logic_then():string;
    There should not be any parenthesis in the variable
    declaration.
    4.
    this is wrong
    var Question():Question=new Question();
    this even wronger
    var Question():Array=new Question(); // I'm trying to create
    an array here anyway...could this be the problem??
    no parenthesis!
    var Qs():Question=new Question();
    hmmmm....
    .var Qs()=new Question();
    I think you should start reading from the following link to
    get more understanding of the variables, types & declarations:
    http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00001863.html
    Cheers,
    Dmitri.

  • Loading defining global variables?

    Hello all!
    I have a project that is an online presentation, which I (being no pro in codeing) create in Edge and Muse. I create the animation in Edge, publish it as OAM and place it into the muse site/page. Master looks fine and I am happy with it.
    My problem, that I have to solve, is that it has to be translated into 44 Languages and kept updated regularly, which is near to impossible without using external data source.
    I thought to create an XML file for each language and use it for text and maybe Image content. I can use an xml file for a specific animation, but at my current knowledge level i!Il have to define the variables and the source of content for each and every animation/object.
    What I would like to see is that if you land on the Index page, you can choose the preferred language, and all the content appeares in the given language. For that (my best guess) I'll have to define global variables, which do not lose their value i.e.: which is my preferred language.
    How do I do that? Had anyone a similar issue? Also, how do I use external data in Muse?
    Any help would be appreciated!
    Greetz
    ND

    Here it is :
    In the Stage > document.compositionReady event handler, we define a JavaScript object LANG containing
    • a property flag that is the state of the displayed flag (in the example file, symbol drapeau, french for flag) ;
    • a function switchLang executed each time the flag is clicked, to refresh the content of
    - the three titles (b1A_tit, b1B_tit, b1C_tit) by  assigning hard-coded values,
    - the three texts (b1A_txt, b1B_txt, b1C_txt) by loading HTML snippets files in a text folder.
    LANG =
      flag: 'NL',
      switchLang: function()
        sym.getSymbol('bandeauH').getSymbol('drapeau').stop( LANG.flag);
        var symBloc1A = sym.getSymbol("bloc1A");
        var symBloc1B = sym.getSymbol("bloc1B");
        var symBloc1C = sym.getSymbol("bloc1C");
        switch (LANG.flag)
          case 'NL':
            symBloc1A.$('b1A_tit').html("Montagne");
            symBloc1A.$('b1A_txt').load('text/b1A_FR.html');
            symBloc1B.$('b1B_tit').text("Peinture");
            symBloc1B.$('b1B_txt').load('text/b1B_FR.html');
            symBloc1C.$('b1C_tit').text("Maison d’hôtes");
            symBloc1C.$('b1C_txt').load('text/b1C_FR.html');
            LANG.flag = 'FR';
            break;
          case 'FR':
            symBloc1A.$("b1A_tit").text("Montagne");
            symBloc1A.$('b1A_txt').load('text/b1A_NL.html');
            symBloc1B.$("b1B_tit").text("Schilderen");
            symBloc1B.$('b1B_txt').load('text/b1B_NL.html');
            symBloc1C.$("b1C_tit").text("Bed & Breakfast");
            symBloc1C.$('b1C_txt').load('text/b1C_NL.html');
            LANG.flag = 'NL';
            break;
    LANG.switchLang();
    The drapeau > click event handler is a single call to LANG.switchLang();
    Download the example file here : https://app.box.com/s/f8boa2oswnowyl3ehb2o
    Gil

  • Use a string to define data

    Hello experts
    Is there a way to do this: get a table name as a string  from a query and use it to define another variable
    For example:
    data: line TYPE RSDSSEG.
    select * from RSDSSEG into line where DATASOURCE = '/CW1/MMD01'.
    ENDSELECT.
    psatablename = line-psa.
    *now psatablename contains the name of the abap table i would like to read
    the following two lines do not work
    data: psaline type psatablename.
    select * from psatablename into psaline.
    Thanks a lot for your help
    Thibault

    Yes it is possible.
    Pl. check this sample code.
    DATA:
          dy_table TYPE REF TO data,
          dy_line TYPE REF TO data.
    FIELD-SYMBOLS                                                       *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY.
    Create internal table dynamically with the stucture of table name
      CREATE DATA dy_table TYPE STANDARD TABLE OF (psatablename).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc = 0.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Select data from table
      SELECT * FROM (psatablename)
      INTO TABLE <dyn_table>.
      ENDIF.
    Regards,
    Joy.

  • Store Session scoped variable in RequestScoped FormHandler?

    Hi All,
    I need to store a value into session scoped variable in formHandler. Is it possible? For Example, i need to no.of times handleApplyShippingGroups is being called by a User (Session scoped) and write a condition based on that value whose effect is to that User only? But, ShippingGroupFormHandler's scope is "Request"? How to get through this?
    Thanks,
    VishnuVardhan

    Hi,
    You can use the below logic.
    In ShippingGroupFormHandler.properties
    $class = your.custom.Shippinggroup.fomhandler
    profile=/path/to/your/profile/component
    In YourShippingGroupFormHandler.java
    Inside handleApplyShippingGroups(),
    //increment the value
    getProfile.setApplySgCallCount(getApplySgCallCount()++);
    Before that, add the property - applySgCallCount -  to your profile with getter and setters.
    Hope this helps.
    Please keep posting the issues / updates.
    Thanks,
    Gopinath Ramasamy

  • Defining a variable outside a class.

    Is there anyway I can define a variable outside a class, so that it can be accessable to many different classes. For instance if i have a String:
    homedirectory="c:/home/". How can I make it other classes access the content of this string, without having to define it in every class??
    Cheers.

    Is there anyway I can define a variable outside a
    class,No, all variables must be in a class.
    so that it can be accessable to many different classes.A public static field can be accessed in any class.
    For instance if i have a String: homedirectory="c:/home/". Do you mean like System.getProperty("user.home") ?
    How can I make it other
    classes access the content of this string, without
    having to define it in every class??Use a system property so it can be set on the command line or a public final static field in a class.

Maybe you are looking for

  • How to connect my iphone to imac on wifi

    Hi I want to connect my iphone to imac on wifi. Actually i want to use internet on my iphone. So how can i do this ?

  • Cumulative quantities not showing

    Hi experts, I have defined following structure in BEx query designer. The cumulative balance column is not displaying correct result. The "cumulated" option has been selected for the formula "Cumulative Balance". --- Debit | Credit | Monthly Balance

  • HT4436 Can I create a second email account?

    How do I create a second iCloud email account?

  • Tuning Phase

    Couple general questions. I am about 3 weeks into the tuning phase on my 4250XL sensor. We are monitoring the Email DMZ as well as the General Population network. Are there any specific sig that are not on by "default" that any of you would recommend

  • Ratings Views in ITunes 7.0

    I guess I could post it as a question but why bother. Clearly nobody cares about fixing the My Ratings view in ITunes. Now, in the new version, it functions even worse than in the last iteration. It doesn't work, as always, in the "Edit Smart Playlis