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.

Similar Messages

  • 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.

  • How define a global variable in a class that all the methods will recognize

    hi friends,
    i need to define a global variable in a class that all the methods will recognize it.
    any suggestions?
    thanks,
    dana.

    Dera Dana,
    In se24, create your own "Z" class.
    Open the Attributes tab.
    Insert your variable in the declaration part.
    EQ:
    Attribute     Level                       Visibility   Typing      Associated Type         Description        
    ITAB     Instance Attribute     Public     Type     Structure name     Description
    In the Layout of View page,
    <phtmlb:formLayoutDropDownListBox id                = "Dropdown"
                                              label             = "Drop Down"
                                              table             = "<%= controller->Itab %>"
                                              nameOfKeyColumn   = "CODE"
                                              nameOfValueColumn = "VALUE"
                                              selection         = "<%= controller->feild to be selected %>"
                                               />
    Hope this will be helpful
    Regards,
    Gokul.N

  • Defining variables from a class gives errors

    Hi,
    I'm trying to create a questionnaire, that can hold an array
    of questions.
    The questions can be of different types, like single punch,
    multi punch, open text etc.
    Much of the code below is copied from examples I've found and
    I am definitely in the beginning
    of my learning process when it comes to Flex, but I think
    Flex can solve a problem I have at work.
    So, I'm trying to cut corners...
    I created this class called Questions, which contains all
    properties any question can have.
    When I'm trying to define a variable (myQuestion) based on
    that class, I the following error.
    (actually I get it on all properties...)
    Error:
    1120: Access of undefined property Qtype.
    This is 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(
    Qtype: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 )
    this.Qtype=Qtype;
    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;
    This is the part of the code that generates the error:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.states.State;
    import mx.controls.Alert;
    import mx.events.CloseEvent;
    import flash.events.KeyboardEvent;
    import Mycomponents.Codeframe;
    import Mycomponents.Question;
    public var myQuestion:Question = new Question(
    Qtype,
    Condition,
    Qnumber,
    Qheading,
    Pretext,
    Qtext,
    Posttext,
    Codeframe,
    Reserved,
    EditableFrom,
    EditableTo,
    Decimal,
    SetQfactor,
    Logic_if,
    Logic_then
    ....more code...
    ...what am I missing in defining this variable?
    If you have a link to a good book on Flex...let me know.
    Regards
    /Acke

    When you create your local variable myQuestion, where are the
    parameters (used in the constructor) declared and initialized?
    var _qType = "some value";
    var myQ:Question = new Question(_qType,"","" etc);
    Also good OO practice is to declare your variables as private
    and add getters and setters for the values. Sometimes you may want
    to manipulate the values when getting or setting.
    If you use the standard AS3 get and set then declare your
    vars with an _
    so as not to conflict with the getter and setter. For exampe:
    public class MyClass
    private var _var1:String;
    public function get var1():String
    return _var1;
    public function set var1(v:String):void
    _var1 = v;
    This may seem like extra work, but in a complex application
    with lots of classes
    encapsulating updating of members will save you lots of
    headaches.

  • How to pass a variable from one class to another class?

    Hi,
    Is it possible to pass a variable from one class to another? For e.g., I need the value of int a for calculation purpose in method doB() but I get an error <identifier> expected. What does the error mean? I know, it's a very, very simple question but once I learn this, I promise to remember it forever. Thank you.
    class A {
      int a;
      int doA() {
          a = a + 1;
          return a;
    class B {
      int b;
      A r = new A();
      r.a;  // error: <identifier> expected. What does that mean ?
      int doB() {
         int c = b/a;  // error: operator / cannot be applied to a
    }Thank you!

    elaine_g wrote:
    I am wondering why does (r.a) give an error outside the method? What's the reason it only works when used inside the (b/r.a) maths function? This is illegal syntax:
    class B {
      int b;
      A r = new A();
      r.a;  //syntax error
    }Why? Class definition restricts what you can define within a class to a few things:
    class X {
        Y y = new Y(); //defining a field -- okay
        public X() { //defining a constructor -- okay
        void f() { //defining a method -- okay
    }... and a few other things, but you can't just write "r.a" there. It also makes no sense -- that expression by itself just accesses a field and does nothing with it -- why bother?
    This is also illegal syntax:
    int doB() {
          A r = new A();
          r.a;  // error: not a statement
    }Again, all "r.a" does on its own is access a field and do nothing with it -- a "noop". Since it has no effect, writing this indicates confusion on the part of the coder, so it classified as a syntax error. There is no reason to write that.

  • Loading Variables in a Class Function

    I am having problems loading variables from an external text
    file inside of a class function. The text file has been created
    properly, and the code that I use in the class is as follows:
    _root.createEmptyMovieClip("texRules", -100);
    loadVariables("texRules.txt", _root.texRules);
    m_Rules = _root.texRules.rules;
    I create an empty movie clip on the root frame named
    texRules, load the variables into that movie clip with the next
    line and then set my member string value equal to the text file
    variable named rules. When I run the program, I get an undefined
    for my m_Rules.
    Here is my texRules.txt:
    rules=THESE ARE THE TEXAS HOLD'EM RULES.
    Any ideas as to what I am doing incorrectly?

    I've opted to use the LoadVars instead of creating an empty
    movie clip and loading the variables there. Here is my new code.
    public function setRules():Void
    var rulesLoader:LoadVars = new LoadVars();
    rulesLoader.onLoad = function (success:Boolean):Void
    if (success)
    trace(rulesLoader.rules);
    this.m_Rules = rulesLoader.rules;
    else
    trace( "Unable to load external file.");
    rulesLoader.load("texRules.txt");
    Here is where I define my properties of my class:
    class TexHoldem extends Game
    //Class member properties
    //Private Properties
    private var m_Rules:String;
    private var m_Target:MovieClip;
    Here is my constructor:
    public function TexHoldem(target)
    this.m_Target = target;
    super("Texas No Limit Hold'Em", 0, 1);
    setRules();
    The setRules function works fine, the only problem now is
    that I can't save the variables once the onLoad function goes out
    of scope. I've thought of modifying it so that it returns a type,
    but that seems difficult. The two easiest solutions I see is to
    create an empty text field that holds the string or find a way to
    get the rulesLoader.rules outside of the onLoad scope. Any
    suggestions now? Sorry to change the problem on you.

  • Is there a way to reference a private variable from one class in another?

    My first class starts off by declaring variables like so:
    class tStudent {
      // declare student name, id, grades 1 & 2, and gpa
      private String fname, lname, g1, g2;
      private int id;
      private double gpa;
      // define a constructor for a new student
      tStudent () {fname=lname=g1=g2=null; id=-1; gpa=0.0;}
      // define methods for manipulating the data members.
      // readStudent: reads information for just one student
    public void read (Scanner input) {
          fname = input.next();
          lname = input.next();
          id = input.nextInt();
          g1 = input.next();
          g2 = input.next();
    }And the second class:// tStudentList: for a list of students
    class tStudentList {
      private int nStudents;
      private tStudent[] list;
      // constructor for creating student list
      tStudentList() {
          list = new tStudent[36];
          for (int i=0; i < 36; i++) list=new tStudent();
    // read the individual students into the student list
    public void read(Scanner scan) {
    nStudents=0;
    while (scan.hasNext()) {list[nStudents++].read(scan);}
    // display the list of all students - fname, lname, id, g1, g2 and gpa
    // with an appropriate header so the output matches my sample //output
    public void print() {
    Is there a way to reference the variables in the first class to use in the second? Specifically in the last section of code where I am going to print the list.

    Not without resorting to reflection hackery. If the fields are private (and are supposed to be), then that means "don't allow access to these to outsiders of this class" by design.
    So if you really meant them to be accessible, then don't use private, or provide public accessors for them.

  • Using a variable from one class to another

    Hi !
    I've a class called ModFam (file ModFam.java) where I define a variable as
    protected Connection dbconn;
    Inside ModFam constructor I said:
    try
    String url = "jdbc:odbc:baselocal";
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    dbconn = DriverManager.getConnection(url);
    System.err.println("Connection successful");
    } ..... rest of code
    This class define a TabbedPane as follows:
    tabbedPane.addTab("Welcome",null,new Familias(),"Familias");
    As you can see it call a new instance of the Familias class (file Familias.java).
    This constructor will try to connect with the DB to populate a combo box with some data retireved from the DB.
    If I do
    Statement stmt;
    stmt = dbconn.createStatement();
    inside Familias constructor I receive the message
    Familias.java:50: cannot resolve symbol
    symbol : variable dbconn
    location: class fam.Familias
    stmt = dbconn.createStatement();
    at compile time.
    While I can�t use a variable defined as "protected" in one class of my package on another class of the same package ?
    How could I do ?
    Thanks in advance
    <jl>

    Familias doesn't have a reference to ModFam or the Connection.
    So change the constructor in Familias to be
    public class Familias {
      private ModFam modFam;
      public Familias(ModFam m) {
        modFam = m;
    // ... somewhere else in the code
    Statement stmt = modFam.dbconn.createStatement();
    }or
    public class Familias {
      private Connection dbconn;
      public Familias(Connection c) {
        dbconn = c;
    // ... somewhere else in the code
    Statement stmt = dbconn.createStatement();
    }And when you instantiate Familias it should then be
    new Familias(this) // ModFam reference
    or
    new Familias(dbconn)

  • Sending a variable from one class to another?

    Dear Java Users - please can you help me out here... I know that what I am asking should be straight forward BUT I just don't understand any of the responses people have put on the web....
    Here is what I am trying to do:
    This piece of code - creates a window with a simple textbox on it to enter a word...
    The button then calls another class file to open a new window...
    All I want to do is to take the word from the text box and print it in the new window....
    The first .java file I have is this:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class FrontPageGUI extends JFrame implements ActionListener
         //declare all instance variables for THIS per class
              JLabel lblInfoOne;
              JLabel lblButtonPopUp;
              JTextField txtName;
              JButton close;
              JButton popUp;
         public FrontPageGUI()
              //set characteristics of the JFrame object
              super("Title Bar");
              setSize(600,600);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              //we need to define a Container to place objects onto the frame - this is inside the JFrame Object Above
              Container ca = getContentPane( );
              ca.setSize(600,600);
              ca.setBackground(Color.white);
              ca.setLayout(null);                
              //define all other objects and set thier characteristics
              lblInfoOne     = new JLabel("Enter a word in the box above to send:");
              lblButtonPopUp = new JLabel("Click Here:");
              txtName          = new JTextField("");
              //create Button components
              close = new JButton("Close");
              popUp = new JButton("Click Me");
              //now add all objects to the container
              //Labels
              addXY(ca,lblInfoOne, 30, 160, 550,45);
              addXY(ca,lblButtonPopUp, 30, 210, 550,45);
              //TextField
              addXY(ca,txtName, 120, 100, 200,30);
              //Buttons
              addButtonXY(ca, popUp, 30, 260, 200, 45);
              addButtonXY(ca, close, 30, 310, 80, 30);
              // add the Container to the Frame     
              setContentPane(ca);          
         void addButtonXY(Container c, JButton cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               cp.addActionListener(this);
               c.add(cp);     
         void addXY(Container c, Component cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               c.add(cp);
         public void actionPerformed(ActionEvent event)
              if (event.getSource()== popUp)
                   //This is WHERE THE PROBLEM IS...
                   //Here I want to send to contents of the textfield - txtName
                   String temp = txtName.getText();
                   new PopUpGUI(temp);
              if (event.getSource()==close)
                   closeUp();
         void closeUp()
              System.exit(0);
              //dispose();
    //we need a driver program - this is the only time MAIN is used.
    public class FrontPage
         //create an instance of the GUI and showit
         public static void main(String args [])
              new FrontPageGUI();
                   The second .java file I have is this:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class PopUpGUI extends JFrame implements ActionListener
         //declare all instance variables ie per class
              JLabel headerLabel;
              JLabel sentLabel;          
              JButton close;
         public PopUpGUI(String Sent)
              //set characteristics of the JFrame object
              super("Pop Up Window");
              setSize(320,450);
              setVisible(true);
              //need to define a Container to place objects onto the frame
              Container ca = getContentPane( );
              ca.setSize(320,450);
              ca.setLayout(null);                
              //define all other objects and set characteristics
              headerLabel = new JLabel("New Window!"); //heading label
              sentLabel = new JLabel(Sent);
              close = new JButton("Close");
              //now add all objects to the container
              addXY(ca,headerLabel,10,10,380,80);
              addXY(ca,sentLabel,10,100,380,80);
              addButtonXY(ca, close, 50, 200, 100, 30); //Bottom Left
              // add the Container to the Frame     
              setContentPane(ca);
         //We need these 2 methods - EVERY TIME
         void addButtonXY(Container c, JButton cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               cp.addActionListener(this);
               c.add(cp);     
         void addXY(Container c, Component cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               c.add(cp);
         //What to do when the click happens
         public void actionPerformed(ActionEvent event)
              if (event.getSource()==close)
                   dispose();
                   //closeUp(); - Doesn't run CLOSEUP this time (i.e. exit program) - instead just DISPOSEs of the window
    //Driver class is in FrontPage.javaThis seems to work... but is it the best way to do it????
    Tony.

    Well,
    Using the constructor is the way to go. Otherwise create a method that takes the string as parameter.

  • To use a static variable in another class,but report NullPointerException

    when TableMain is running,I run testRecord so that let TableMain add a occur informatin and
    happened time in a row in TableMain,but when I run testRecord,java report a NullPointerException and I dont know how to solve this problem,thanks for helping me to check my code;(error report info is in end)
    import java.awt.event.*;
    import javax.swing.table.*;
    import java.io.*;
    public class TableMain extends JFrame{
    JTable table;
    static OwnModel model;
    String[] columnHeader={"occur","time"};
    class OwnModel extends DefaultTableModel{
    public OwnModel(Object[] columnNames,int numRows){
    super(columnNames,numRows);
    public boolean isCellEditable(int row,int column){
    return false;
    public TableMain(){
    model=new OwnModel(columnHeader,0);
    table=new JTable(model);
    JScrollPane scroll=new JScrollPane(table);
    JButton save=new JButton("save record");
    JButton delete=new JButton("delete record");
    JPanel buttons=new JPanel();
    buttons.add(save);
    buttons.add(delete);
    JLabel sign=new JLabel("occur record");
    Container cp=getContentPane();
    cp.add(BorderLayout.NORTH,sign);
    cp.add(BorderLayout.CENTER,scroll);
    cp.add(BorderLayout.SOUTH,buttons);
    this.setSize(300,500);
    this.setVisible(true);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public static void main(String[] args){
    new TableMain();
    import java.util.Vector;
    import java.util.Calendar;
    import java.text.SimpleDateFormat;
    public class testRecord{
    public static void main(String[] args){
    SimpleDateFormat simpledf=new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
    String tableName="friends";
    Calendar occurtime=Calendar.getInstance();
    Vector record=new Vector();
    record.add("send 'desc' sql, "+"operated table is :"+tableName);
    record.add(simpledf.format(occurtime.getTime()));
    System.out.println("model is "+Guide.model);
    System.out.println("record is "+record);
    Guide.model.addRow(record);
    error report:
    model is null
    record is [send 'desc' sql,operated table is :friends, 2004/05/26 11:39:03]
    Exception in thread "main" java.lang.NullPointerException
    at testRecord.main(testRecord.java:14)

    but I just use this constructor once,never use twice
    with same jvm;I thinks my idea is not too very badIt's a public constructor (if I'm looking in the right
    place) - it could be called from anywhere. To
    intialize a static variable outside the declaration,
    use a static initializer:private static String whatever;static {
    whatever = "whatever";
    }Or simply (in this case):private static String whatever = "whatever";

  • Accessing public variables from other classes

    Probably a simple questions, but how can I access a variable from another class. My exact situation is as follows.
    A class called WorldCalender has a variable which is defined: public int hour; (the value is given to it elsewhere).
    I want to access this variable and increase it by one in a subroutine in the class Hour. In this class I have put: WorldCalender.hour++; but it doesn't seem to work. How should I do it?

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • Use of variables from other class

    hallo,
    i have two classes A and B
    i would like to access a variable of the class B out of A class
    without class A extends B or
    A classA = new A();
    to use
    i attempted it with a constructor
    class A{
        B klb;
        public A(B b1){
        this.klb = b1;
       int a;
       a= klb.varausB;
    }with that I get, however, a NullPointerException
    in a similar form i saw it already once and it functioned
    somebody can help me?

    that is it what I mean
    public class ClassA {
    ClassB clb;
    public ClassA (ClassB cb){
    this.clb = cb;
    public static void main(String[] args) {
    System.out.println("Var from class B:
    class B: "+clb.varb1);// there is an error, i know
    but how it is right?
    public class ClassB {
    public String varb1 ="var b1";
    }nevertheless so similarly it should function, or?So if you create an instance of ClassA, clb will be initialized. But you don't do that in main. Hence your errors:
    1) You're not calling the constructor, so clb is null
    2) You're trying to access an instance variable without having an instance, so clb is not only null, it actually doesn't exist.
    public static void main(String[] args) {
      Class A myA = new ClassA();
      System.out.println("Var from class B: "+ myA.clb.varb1);
    }You're outside of any object, ehnce you need to address clb through an instance of ClassA.

  • How to call a variable in another class????

    if i have two classes in a package. From one class, how do i get the value of one of the variable in the other class.
    For example;
    Class A have a variable call totalNum which have a value initialise.
    Class B wan to get the value variable totalNum in class A.
    So do i go abt calling it?
    Cheers

    For example;
    Class A have a variable call totalNum which have a
    value initialise.
    Class B wan to get the value variable totalNum in
    class A.Your explanation is far from clear. Is the variable in class A a field? If yes, is it a static field? Is it declared public, private, etc.?
    If you don't understand the above questions, you should do the following:
    1) Learn the basics of the Java language from the Java Tutorial and/or from an entry-level book: http://java.sun.com/docs/books/tutorial/
    2) Post future question in the New To Java Technology forum.

  • 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;

  • How to access variables from other class

        public boolean inIn(Person p)
            if  (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
                 return true;
            else
                 return false;
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
    here am trying to compare the existing object with another object.
    could you please tell me how to access the variables of other class because i meet this error?
    name cannot be resolved!
    thank you!

    public class Person
        protected String name; 
        protected char gender;      //protected attributes are visible in the subclass
        protected int dateOfBirth;
        protected String address;
        protected String natInsceNo;
        protected String phoneNo;
        protected static int counter;//class variable
    //Constractor Starts, (returns a new object, may set an object's initial state)
    public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
        dateOfBirth = howOld;
        gender = sex;
        name = nme;
        address = addr;
        natInsceNo = ins;
        phoneNo = phone;
        counter++;
    public class Store
        //Declaration of variables
        private Person[] list;
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             list = new Person[max];//size array with parameters
             maxSize = max;
             count = 0;
        }//end of store
    //constructor ends
    //accessor starts  
        public boolean inIn(Person p)
           return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now!

Maybe you are looking for

  • RemoteFX on Windows 2008 R2

    Hi, I've read many different articles about RemoteFX and the latest Resource Kit book and am finding it really hard to get a definite answer to a couple of questions. I have a physical HP DL385 G7 server currently running Windows 2008 R2. I plan to p

  • How to get rid of trojan horses

    whats the best way to get rid of trojan.download. this is my first mac. i just want the best product for my computer(love my mac).

  • Web service VS Direct DB access

    Hi, I am completely new to data warehouse. Recently, i need to build a data warehouse that get data from one of the transaction databases for data analysis. I am struggling whether i should get the required data by web service or directly access the

  • AssignMessages Error

    Hi, I have a BP in which I assign (append) messages in a Multiple container. But after my Business scenario tests I receive Error: <SAP:Category>XIAdapter</SAP:Category> <SAP:Code area="BPE_ADAPTER">UNKNOWN_MESSAGE</SAP:Code>   <SAP:P1 />   <SAP:P2 /

  • Where to Synchronize Struts 1.1

    Hello, I need to thread safe a very basic struts app (1.1 so not ingherently thread safe). It get user info and inserts it into a db, but there are sessions involved. The app uses two model classes, users and orders, each with getters and setters tha